Results 1 to 6 of 6

Thread: How To Shorten Superfluous Code From Recorded Macro

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    7
    Rep Power
    0
    Thanks for the help

    I used the recorder and deleted much of the code....i attached workbook....could this be made even simpler?

    Regards

    RK
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    May 2013
    Posts
    31
    Rep Power
    0
    The fewer times that you reference an object the better. This is easy to read anyway.
    Code:
    Private Sub CommandButton2_Click()
      With Range("E4:N4")
        .Interior.ColorIndex = 3
        .Font.Bold = True
        .Font.Size = 16
        .Font.Color = rgbWhite
        .FormulaR1C1 = "=RC[-1]+1"
      End With
      Range("E4").FormulaR1C1 = "=TODAY()"
      Range("E4:N23").Borders.LineStyle = xlContinuous
      Columns("E:N").ColumnWidth = 17.14
    End Sub

Similar Threads

  1. MACRO CODE TO KNOW MONTH and QUATER
    By Prabhu in forum Excel Help
    Replies: 4
    Last Post: 09-27-2013, 10:16 PM
  2. Replies: 1
    Last Post: 08-23-2013, 06:33 PM
  3. Shorten VBA Code By Removing Redundant Superfluous Code
    By paul_pearson in forum Excel Help
    Replies: 2
    Last Post: 08-15-2013, 09:09 PM
  4. Replies: 0
    Last Post: 07-24-2013, 11:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •