-
1 Attachment(s)
How To Shorten Superfluous Code From Recorded Macro
-
Code:
Sub Macro1()
Range("E4:N23").Select
Selection.Borders.LineStyle = xlContinuous
End Sub
-
Don't need to write 'Select'
Code:
Range("E4:N23").Borders.LineStyle = xlContinuous
-
To go beyond the recorder: Beyond Excel's recorder
-
1 Attachment(s)
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
-
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