ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,953
- Office Version
- 2007
- Platform
- Windows
Morning,
Im using the code shown below but when i press the command button nothing happens at all.
Do you see an issue.
Thanks
Worksheet called NAMES
Table name is Table4
Headers in row 1
Currently Range is A2:E43
Sort A-Z in column A
Im using the code shown below but when i press the command button nothing happens at all.
Do you see an issue.
Thanks
Worksheet called NAMES
Table name is Table4
Headers in row 1
Currently Range is A2:E43
Sort A-Z in column A
Rich (BB code):
Private Sub CommandButton1_Click()
Dim x As Long
Dim ws As Worksheet
Set ws = Sheets("NAMES")
Dim SortColumn As String
If Len(SortColumn) <> 0 Then
Application.ScreenUpdating = False
With ws
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A2:E" & x).Sort Key1:=.Cells(2, SortColumn), Order1:=xlAscending, Header:=xlGuess
End With
End If
End Sub