I'm making a VBA macro. At one point, the macro tells excel to change the current autofilter to have the autofilter's sort be on the column in Column A
, and it should be ascending.
But, the VBA code that I have now states that the RANGE is hard-coded which is Range(A1:A655)
,that's because the code was written in a recorded Macro. Below is my VBA code. Can you tell me how to change the A1:A655
not in a hard-coded way, instead make it just generically mean "make the range be ALL of the rows in that column, however much there is?
ActiveWorkbook.Worksheets("A1").AutoFilter.Sort.SortFields.Add Key:=Range(
"A1:A655"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=
xlSortTextAsNumbers
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…