Sorting by multiple conditions VBA

MM91

Board Regular
Joined
Nov 29, 2021
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Hi I have been working on this code that will sort first by Section (Column A) then numerically by Type (Column L) then by date (Column B) and it works as needed. However I need to add a condition that if the cell in column D says "Assy" "Assembly" or "Asm" then it moves that row to the top of the prod. order sorting. Is there a simple way to do this? Thank you!!





Sub SortandFormat()

' Sorts By Section & Then by Part Type & Then By Date
Dim LR As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, 1).End(xlUp).Row
Range("A7:Q" & LR).Sort Range("A7"), xlAscending, Range("L7"), , xlDescending, Range("B7"), xlAscending, xlNo

End Sub
 

Attachments

  • macro 6.png
    macro 6.png
    77.8 KB · Views: 10

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I'd suggest providing a sample file that would make it easier for everyone trying to help, to better understand and suggest solutions accordingly, rather then interpreting the query and making assumptions.
You can upload your file to any free file sharing service like google drive, one drive, dropbox, etc and share the link in the thread.

hth.....
 
Upvote 0
I'd suggest providing a sample file that would make it easier for everyone trying to help, to better understand and suggest solutions accordingly, rather then interpreting the query and making assumptions.
You can upload your file to any free file sharing service like google drive, one drive, dropbox, etc and share the link in the thread.

hth.....
Thank you I was trying to load it through this website but couldn't so i settled for pictures. Heres a link thank you!!

 
Upvote 0
I think you have uploaded wrong file.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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