Need to just tweak this code for sorting a section...

Claire_Brummell

Board Regular
Joined
Sep 29, 2004
Messages
129
Hey, just need to tweak this code:

Code:
' Sorts worksheets
    
    For Worksheet_Counter = 2 To ActiveWorkbook.Sheets.Count - 1
    'MsgBox ("Sorting Sheet - " & Sheets(Worksheet_Counter).Name)
    If Worksheets(Worksheet_Counter).Range("A3") <> "" Then
        Worksheets(Worksheet_Counter).Range("A3").Sort _
        Key1:=Worksheets(Worksheet_Counter).Columns("A"), _
        Order1:=xlAscending, _
        Header:=xlYes
    End If
    Next Worksheet_Counter

Basically I have a merged cell at the top of the page which is the page header.

I then have a row of cells which are my column headers.

I want this code to sort the info in the table (by column A) without including the page or column headers.

I know it must be nearly there but it's just not quite right yet as it's still sorting the column headers too :)

Any help would be appreciated.

Thanks x
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
I changed the "Header:=xlYes" code to "Header:=xlGuess" and it worked for me.
 

Forum statistics

Threads
1,141,759
Messages
5,708,361
Members
421,566
Latest member
7Nabisco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top