I am having trouble with a VBA macro that exports sketch points. I am able to send data from SW to Excel and save the file, but I'd like to sort a range "MyRangeString" within a sheet called "MySheet". Basically, I want to sort by column B then column C. I placed a code snipet below. The data does not sort. I can get the same code to work natively in Excel no problem. Thanks in advance for your help.
MyRangeString = "B2:B" & (i + 1)
MyXRangeString = "B2:B" & (i + 1)
MyYRangeString = "C2:C" & (i + 1)
With MySheet.Sort
.SortFields.Clear
.SortFields.Add Key:=MySheet.Range("B2:B12"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SortFields.Add Key:=MySheet.Range("C2:C12"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange MySheet.Range("A1:C12")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With