I recorded this macro to format a sheet in my project.
The sheet is dynamic so I added LastRow and LastCol references.
How do I change the code to format the used range?
The sheet is dynamic so I added LastRow and LastCol references.
How do I change the code to format the used range?
Rich (BB code):
Sub Macro1()
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$B$1:$R$23"), , xlYes).Name = "Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleLight1"
ActiveSheet.ListObjects("Table1").ShowAutoFilterDropDown = False
Range("A1").Select
End With
End Sub