Hi Experts,
I have an excel sheet where the data "in Plan" columns are all copied in with a macro from different sheets. I need a way programmatically (ie as part of the same macro) to Sort the columns by Row number 2 - "Ship Date" (left to right).
I want the sort to happend At the end of the current VBA code in the macro. I have saved the starting Column and End Column numbers as variables.. ie in this case "E" and "N".
I've tried to use similar code to this -
Range("E1:N1").Sort Key1:=Range("E2:N2"), Order1:=xlAscending, Orientation:=xlLeftToRight
but it keeps failing (obviously I'd need to replace the static column values with a variable, but in this case I was just testing)
please help.
I have an excel sheet where the data "in Plan" columns are all copied in with a macro from different sheets. I need a way programmatically (ie as part of the same macro) to Sort the columns by Row number 2 - "Ship Date" (left to right).
I want the sort to happend At the end of the current VBA code in the macro. I have saved the starting Column and End Column numbers as variables.. ie in this case "E" and "N".
I've tried to use similar code to this -
Range("E1:N1").Sort Key1:=Range("E2:N2"), Order1:=xlAscending, Orientation:=xlLeftToRight
but it keeps failing (obviously I'd need to replace the static column values with a variable, but in this case I was just testing)
please help.