ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,720
- Office Version
- 2007
- Platform
- Windows
Morning.
I have a command button on my worksheet which opens folder folder on my pc for which i keep pdf files.
The files keep changing to smallest number to largest number 1,2,3,4 etc
I have the following code which opens the folder BUT can i add to the code so it sorts the pdf files so i see 4,3,2,1 order.
Thanks.
I have a command button on my worksheet which opens folder folder on my pc for which i keep pdf files.
The files keep changing to smallest number to largest number 1,2,3,4 etc
I have the following code which opens the folder BUT can i add to the code so it sorts the pdf files so i see 4,3,2,1 order.
Thanks.
Rich (BB code):
Private Sub CustomerSortAtoZ_Click()
Dim x As Long
Application.ScreenUpdating = False
With Sheets("DATABASE")
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A5:Z" & x).Sort Key1:=Range("A6"), Order1:=xlAscending, Header:=xlGuess
End With
ActiveWorkbook.Save
Application.ScreenUpdating = True
MsgBox "SORTED A-Z SUCCESSFULLY", vbInformation, "DATABASE SORT A-Z MESSAGE"
Sheets("DATABASE").Range("A7").Select
Sheets("DATABASE").Range("A6").Select
End Sub