Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Syntax - Loop through rows in a selection
Maybe...
Dim x as Range For Each x In Selection.Rows retrievename = Sheets("EmailList").Range("B" & x.Row).value Next x Or Dim iRow as long for irow = selection.row to selection.rows.count + selection.row -1 retrievename = sheets("emaillist").range("B" & irow).value 'or retrievename = sheets("emaillist").cells(irow,"B").value next irow Lisab wrote: I want to modify the following code that loop through each item in a selection ----- Dim x as Range For Each x In Selection retrievename = Sheets("EmailList").Range("B" & x.Row).value Next x ------ I want it to only loop through each row in the selection (not each item) What is the proper syntax I thought Maybe this would work ... but I was wrong. It loops the proper number of times however SelectRow always refers to the first row that is selected -------- For counter = 1 To Selection.Rows.Count SelectRow = Selection.row retrievename = Sheets("EmailList").Range("B" & SelectRow).value Next counter -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Syntax for stopping a Do Loop? | Excel Discussion (Misc queries) | |||
Do...Loop syntax help? | Excel Programming | |||
What is the selection syntax | Excel Programming | |||
VBA Loop Case..If syntax | Excel Programming | |||
loop syntax | Excel Programming |