beginning programming: stop when last column in sheet
Please help: I would like to change the hard coded 10 in the for loop to a
variable that represents the last column in the sheet.
Sub Macro1()
Worksheets(1).Activate
For i = 1 To 10
Worksheets(1)Columns(i).Select
Selection.TextToColumns , DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 2), Array(20, 1)),
TrailingMinusNumbers:=True
ActiveCell.Offset(columnOffset:=1).Select
Next i
End Sub
|