Hello all, I have 2 questions, which are both probably extremely easy for you experienced users. Any help would be much appreciated.
1. Why does something like
not work? Is the only way to accomplish this to doCode:Worksheets("Sheet1").Range("B1").Select
???Code:Worksheets("Sheet1").Select Range("B1").Select
2. As far as sorting, starting in Excel 2007, you can sort with up to 255 sort fields, right? I noticed that selecting some range and doing .Sort and then typing in Key1:= and Key2:= and Key3:= works, but only up to 3 sort fields can be used in this way. Why is that? I have found an alternative (from recording a macro). Is this the only way? It would be doing something like
That is, using that method, you can add more than 3 keys and it works just fine.Code:With ActiveWorkbook.Worksheets("sheet1").Sort .SortFields.Clear .SortFields.Add Key:=Range("B1") and add more keys as you need, then later .SetRange Range("A1:X30") ' or whatever .Apply End With
Also, regarding this question, my number of rows might change from time to time and I don't want to have to redo the code each time. Can I use
.SetRange UsedRange
to get all my data in there?
Thanks!




Reply With Quote
