Thread
:
Loop from left to the right
View Single Post
#
5
Posted to microsoft.public.excel.programming
Gord Dibben[_2_]
external usenet poster
Posts: 621
Loop from left to the right
Kinda missed the reading part.
Thought you wanted to go across from A2.
See Auric's post.
Gord
On Mon, 12 Mar 2012 15:33:27 -0700, Gord Dibben
wrote:
Dim rng As Range
Dim I As Integer
Dim X as range
I = 2
With Worksheets("sheet2")
Set rng = .Range(Cells(I, "A"), Cells(I, Columns.Count).End(xlToLeft))
For Each X in rng
'do stuff
Next X
End With
Gord
On Mon, 12 Mar 2012 14:23:51 -0700 (PDT),
wrote:
With Worksheets("sheetA")
Set rng = .Range("a2", .Range("a" & Rows.Count).End(xlUp))
For Each X In rng
'
Next X
End With
With above code i can loop through all rows of my data in column(A).
Say my data consists of unknown numbers of rows and columns and i want to loop from last cell of column(A) to the right most column which is unkown. I mean from left most to the right most column of last row with data.
How can i modify above code for that purpose ?
Thank you very much in advance.
Reply With Quote
Gord Dibben[_2_]
View Public Profile
Find all posts by Gord Dibben[_2_]