Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I'm trying to sort an Excel spreadsheet by A1 then B1. I recorded a macro and looked at the VBA code and it looks like I have the syntax correct, but I get a "Reference is not valid" error. Below is some code with comments. Thanks. Set objExcelRange1 = objExcelWs.UsedRange Set objExcelRange2 = objExcel.Range("A1") Set objExcelRange3 = objExcel.Range("B1") objExcelRange1.Sort objExcelRange2,1,,,,,,,1 '<< This works ok for sorting by A1 only objExcelRange1.Sort objExcelRange2,1,objExcelRange3,1,,,,,1 '<< I get an error here -- Regards, Martin X. MCSA: M |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Script to sort tables | Excel Discussion (Misc queries) | |||
Sort Column Script | New Users to Excel | |||
Sort Column Script | Excel Programming | |||
need help righting script to sort rows alphabetically then seperate them to line up | Excel Programming | |||
need help righting script to sort rows alphabetically then seperate them to line up | Excel Worksheet Functions |