R
Richard
Having problem with this code:
Private Sub CommandButton1_Click()
Me.CommandButton1.Caption = "Sort"
Dim rng As Range, rng1 As Range
With Worksheets("HList")
Set rng = .Range(.Cells(3, "A"), .Cells(Rows.Count, "A").End(xlUp))
Set rng1 = .Cells(3, "A").End(xlToRight)
Set rng = rng.Resize(, rng1.Column)
rng.Sort _ 'Having problem here I think
Key1:=.Range("A3"), _ 'Having problem here
Order1:=xlAscending, _ 'Having problem herre
Header:=xlNo 'Having problem here
End With
Application.OnTime Now + TimeSerial(0, 0, 2), _
ThisWorkbook.Name & "!ResetCaption"
CommandButton1.Caption = "Sorting..."
End Sub
Sub ResetCaption()
If Not Sheet2 Is Nothing Then
Sheet2.CommandButton1.Caption = "Sort"
End If
End Sub
Thanks in advance!
Private Sub CommandButton1_Click()
Me.CommandButton1.Caption = "Sort"
Dim rng As Range, rng1 As Range
With Worksheets("HList")
Set rng = .Range(.Cells(3, "A"), .Cells(Rows.Count, "A").End(xlUp))
Set rng1 = .Cells(3, "A").End(xlToRight)
Set rng = rng.Resize(, rng1.Column)
rng.Sort _ 'Having problem here I think
Key1:=.Range("A3"), _ 'Having problem here
Order1:=xlAscending, _ 'Having problem herre
Header:=xlNo 'Having problem here
End With
Application.OnTime Now + TimeSerial(0, 0, 2), _
ThisWorkbook.Name & "!ResetCaption"
CommandButton1.Caption = "Sorting..."
End Sub
Sub ResetCaption()
If Not Sheet2 Is Nothing Then
Sheet2.CommandButton1.Caption = "Sort"
End If
End Sub
Thanks in advance!