Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm want to sort two worksheets within the same workbook.
I have code that is working for each individual worksheet. I'm trying to avoid having to physically be in each worksheet. Here is the code that I have - Worksheet 1 Dim shtworksheet As Worksheet Dim LastRw As Long Dim rngData As Range Set shtworksheet = _ Application.Workbooks("test.xls").Worksheets("Curr ent") Set rngData = shtworksheet.Range("B6").CurrentRegion LastRw = Range("B65536").End(xlUp).Offset(-15, 0).Row Range("B6:T" & LastRw).Select 'sort data by purchase date Selection.sort Key1:=Range("B6"), Order1:=xlAscending, Header:=xlGuess 'sort by due date 'Selection.sort Key1:=Range("N6"), Order1:=xlAscending, Header:=xlGuess Range("O1").Select ActiveCell.FormulaR1C1 = "PURCHASE DATE" Worksheet 2 Dim shtworksheet1 As Worksheet Dim LastRw As Long Dim rngData As Range Set shtworksheet1 = _ Application.Workbooks("test.xls").Worksheets("Matu red") Set rngData = shtworksheet1.Range("B6").CurrentRegion LastRw = Range("A65536").End(xlUp).Row Range("B6:T" & LastRw).Select Selection.sort Key1:=Range("B6"), Order1:=xlAscending, Header:=xlGuess Range("O1").Select ActiveCell.FormulaR1C1 = "PURCHASE DATE" Any help would be greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting Existing Totals Into A New & Separate Column | Excel Worksheet Functions | |||
Sorting "State" Column onto separate worksheets in same workbook. | Excel Worksheet Functions | |||
Save 2 separate data imports in separate worksheets on the same ex | Excel Worksheet Functions | |||
sorting data into separate worksheets | Excel Worksheet Functions | |||
Separate Column Sorting | Excel Worksheet Functions |