Sorting specific Rang of Cell in Multiple sheets of a Workbook having same Formate, Rows and Columns

Qazi Sharifullah

New Member
Joined
May 11, 2017
Messages
19
Good Morning,
I have 338 Sheets in a workbook and Having different data but the heading row is same in all sheets A8.
I want to Sort Data in All sheets from A9 to AR18 on the basis of Column AD (Heading AD8). I need Help about this As It spend Hours when I Sort individually each sheet.



Thanks
Regards: Qazi Sharifullah
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hello Qazi Sharifullah Bhai,
try this (y)
Code:
Option Explicit
Sub hi()
Dim i, lastrow As Long
For i = 1 To Worksheets.Count
lastrow = Worksheets(i).Cells(Cells.Rows.Count, "AD").End(xlUp).Row
Worksheets(i).Range("A9:AR18" & lastrow).Sort key1:=Worksheets(i).Range("AD9" & lastrow), order1:=xlAscending, Header:=xlNo
Next
End Sub
Best of Luck (y)
 
Upvote 0
Maybe
Code:
Sub Quazi()
   Dim Ws As Worksheet
   For Each Ws In Worksheets
      Ws.Range("A8:AR18").Sort key1:=Ws.Range("AD8"), order1:=xlAscending, Header:=xlYes
   Next Ws
End Sub
 
Upvote 0
Which code are you talking about & in what way "its not working"?
 
Upvote 0
Yes i have formula in this cell (sum formula)

Then you will probably find it is recalculating the formula after the sort as both codes sort ascending from AD9 (and yes I have tested them although the first code has an issue with the last cell in the range).

On a copy of of your workbook copy/paste as values column AD and test.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,242
Members
448,951
Latest member
jennlynn

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