This is my sample data.
And this is the VBA code produced with macro when I selecting all (ctrl + A) inside A1:C3
, then change the table format.
Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1:C3").Select
Application.CutCopyMode = False
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$C$3"), , xlYes).Name = _
"Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleMedium9"
End Sub
Output
The problem started when I have more data, let say bigger range A1:C4
.
The code above won't select all, instead it selects only A1:C3
.
Last row A4:C4
won't be affected with this code.
How do I change this doesn't matter how big the table is?
"A1:C3"
, see this link for named ranges excel-easy.com/examples/dynamic-named-range.html