Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort referencing incorrect worksheet
I'm trying to accomplish the following: - Concatenate 4 Worksheets into 1 data sheet - Sort the new data sheet I have a separate worksheet that has a command button for initiatin the task. My problem lies in the SORT. For some reason it is tryin to sort the worksheet where the command button is located. Almost a if the Select does not activate the 'TempData' worksheet. My cod follows. Code ------------------- ' Create Data Sheet Call CopyWSToTempData ' this works ' Sort Data newDataSheet = "TempData" Sheets(newDataSheet).Select totalcols = Sheets(newDataSheet).UsedRange.Columns.Count totalrows = Sheets(newDataSheet).UsedRange.Rows.Count shtRange = "A1:K" & totalrows Sheets(newDataSheet).Range(shtRange).Select Range(shtRange).Sort _ Key1:=Range("E1"), Order1:=xlAscending, _ Key2:=Range("F1"), Order2:=xlAscending, _ Key3:=Range("G1"), Order3:=xlAscending, _ Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _ DataOption3:=xlSortNorma ------------------- Help would be appreciated. Thanks -- ingine ----------------------------------------------------------------------- ingineu's Profile: http://www.excelforum.com/member.php...fo&userid=1486 View this thread: http://www.excelforum.com/showthread.php?threadid=51394 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet formula incorrect after copying to another worksheet | Excel Worksheet Functions | |||
incorrect data unexpectly in excel worksheet | Excel Discussion (Misc queries) | |||
Incorrect result using NPER worksheet function | Excel Worksheet Functions | |||
Same formula referencing same cells returns incorrect results, randomly, when pasted into new worksheet | Excel Worksheet Functions | |||
I have saved an incorrect worksheet over the right one. | Excel Worksheet Functions |