lcmilkbone
New Member
- Joined
- Oct 29, 2021
- Messages
- 2
- Office Version
- 2021
- Platform
- Windows
Hi All,
I'm attempting to apply the below code to 26 out of the total 35 sheets. I can't seem to figure it out. Currently the macros is setup to apply to all sheets but I need to either edit it to exclude the eight tabs that it will not apply to, or edit it to apply to the 26 sheets themselves. I do plan on hiding the 26 tabs as they feed into a summary sheet so would this affect the formula?
For context, in each worksheet that requires the sort, columns B to Q have data and I'm sorting by ticker in column C (ascending). Any thoughts here would be greatly appreciated.
Thanks!
I'm attempting to apply the below code to 26 out of the total 35 sheets. I can't seem to figure it out. Currently the macros is setup to apply to all sheets but I need to either edit it to exclude the eight tabs that it will not apply to, or edit it to apply to the 26 sheets themselves. I do plan on hiding the 26 tabs as they feed into a summary sheet so would this affect the formula?
For context, in each worksheet that requires the sort, columns B to Q have data and I'm sorting by ticker in column C (ascending). Any thoughts here would be greatly appreciated.
Thanks!
VBA Code:
Sub SortAllSheets()
Dim WS As Worksheet
ActiveSheet.Range("B1:Q1").Select
Selection.Copy
On Error Resume Next
Application.ScreenUpdating = False
For Each WS In Worksheets
WS.Range("B2:Q500").Sort Key1:=WS.Columns("C"), Order1:=xlAscending
Next WS
End Sub