I'm attempting to sort seven columns in Excel - Columns C through H. I have multiple headings with the data to be sorted starting in row 7. So I'm sorting on C7 through H7 with headings. Column D7 is the key to be sorted on.
Columns A and B and rows 1 and 2 are used by a program called Jet Reports which has already run before the sort routine.
That is why I'm selecting C3 instead of A1 as the starting point.
I get an error message on this line:
An unhandled exception of type 'System.MissingMemberException' occurred in microsoft.visualbasic.dll
Additional information: Public member 'ActiveCell' on type 'Worksheet' not found.
Here is the code adapted from code that works in VBA:
Dim XLApp As Object
XLApp = New Excel.Application
XLApp.Visible = True
XLApp.Interactive = True
.ActiveCell.Offset(2, 0).Range("C3").Select() 'This line causes error
.Selection.Sort(key1:=.Range("D7"), order1:=.xlAscending, Header:= _
.xlYes, OrderCustom:=1, MatchCase:=False)
.Range("C7").Select() ' Returning home
Are there any suggestions on how to correct the error or another way to do the sort?