Specific rows and columns sort in multiple worksheets excel 2013

jlr123

New Member
Joined
Mar 6, 2014
Messages
44
I have specific rows and columns I need to sort on multiple worksheets. Columns A:O and rows 1-126. Can you help me with vba code to run?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
We'll need more information. Is every sheet being sorted the same exact way with the same columns and rows? Are there some sheets you don't want to sort at all? Which column are you sorting by? Do you want it ascending or descending?
 
Upvote 0
You could try something like this (although truthfully I don't fully understand what you mean by "sheets JM:WCH"):

Code:
Sub sort_sheets()

Dim i As Integer
Dim snames As Variant

snames = Array("ESL", "SVC", "JM WCH", "Hoppy")

For i = 1 To Sheets.Count
    If IsNumeric(Application.Match(Sheets(i).Name, snames, 0)) Then
        Sheets(i).Range("A1:O126").Sort key1:=Sheets(i).Range("B1:B126"), order1:=xlAscending, Header:=xlNo
    End if
Next
End Sub
 
Upvote 0
What I mean by "sheets" is all worksheets between and counting first and last- the first worksheet "ESL SVC JM" and last worksheet "WCH Hoppy"
 
Upvote 0
What I mean by "sheets" is all worksheets between and counting first and last- the first worksheet "ESL SVC JM" and last worksheet "WCH Hoppy"

I see, if that is the case, something like this should work:

Code:
Sub sort_sheets()


Dim i As Integer
Dim startTab As Long
Dim endTab As Long


startTab = Sheets("ESL SVC JM").Index
endTab = Sheets("WCH Hoppy").Index


For i = startTab To endTab
    Sheets(i).Range("A1:O126").Sort key1:=Sheets(i).Range("B1:B126"), order1:=xlAscending, Header:=xlNo
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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
Back
Top