YellowLabPro
03-04-2007, 03:03 PM
My code is not working, w/ either of the following subs; cell references specified in the code or w/ the use of an input box. The sort feature does work when used from within Excel. Can someone see what the problem might be? Both codes are included below.
Thank you,
YLP
Sub Macro1()
Dim i As Long
With Range("am38:aw171")
For i = 1 To .Rows.Count
With .Rows(i)
.Rows(i).Sort Key1:=.Rows(i).Range("a1"), Order1:=xlAscending, _
Orientation:=xlLeftToRight
End With
Next
End With
End Sub
Sub Macro1()
Dim rng As Range
Dim i As Long
Set rng = Application.InputBox("Select range with the mouse", Type:=8)
If Not rng Is Nothing Then
With rng
For i = 1 To .Rows.Count
With .Rows(i)
.Rows(i).Sort Key1:=.Rows(i).Range("A1"), Order1:=xlAscending, _
Orientation:=xlLeftToRight
End With
Next
End With
End If
End Sub
Thank you,
YLP
Sub Macro1()
Dim i As Long
With Range("am38:aw171")
For i = 1 To .Rows.Count
With .Rows(i)
.Rows(i).Sort Key1:=.Rows(i).Range("a1"), Order1:=xlAscending, _
Orientation:=xlLeftToRight
End With
Next
End With
End Sub
Sub Macro1()
Dim rng As Range
Dim i As Long
Set rng = Application.InputBox("Select range with the mouse", Type:=8)
If Not rng Is Nothing Then
With rng
For i = 1 To .Rows.Count
With .Rows(i)
.Rows(i).Sort Key1:=.Rows(i).Range("A1"), Order1:=xlAscending, _
Orientation:=xlLeftToRight
End With
Next
End With
End If
End Sub