Process multiple rows

  • Thread starter Thread starter Terry K
  • Start date Start date
T

Terry K

Hello all,
Just wondering if there is someone out there that might have run into
this problem before and would be willing to point me in the correct
direction.
I am attempting to create a macro that will process information based
on the row (s) that the user selects. I am attmpting to allow the used
to select any row(s) that he or she might want but am having trouble
in determining what has been selected. I would like to allow the user
to select any cell(s) on any row(s) and only process the information
on those rows.
An example of this would be a user could select A1, B3, F3 and all of
row 100. From this I would want to process row 1, 3 (but only once
even though it was selected twice) and 100.
From a little research I think that I can read row numbers into and
access them from an array variable in a manner of ARRAY_NAME(counter)
= Row_Number - Is this correct as well?
Any help that anyone would be willing to offer would be greatly
appreciated.
 
hi, Terry !

here is one (possible) approach:

Sub A()
Dim myCell As Range
For Each myCell In Intersect(Range("a:a"), Selection.EntireRow)
MsgBox "Processing row: " & myCell.Row
Next
End Sub

hth,
hector.

__ OP __
 
See if this helps.

Sub makerowarray()
For Each r In Selection
'mr = mr & "," & r.Row
If InStr(mr, r.Row) < 1 Then mr = mr & "," & r.Row
Next r
'MsgBox Right(mr, Len(mr) - 1)
mr = Array(Right(mr, Len(mr) - 1))

End Sub
 
Back
Top