slobber72
asked on
Excel VBA Syntax / usage : For each row in range
Hi,
I have a named range which is 6 columns wide and (say) 100 rows long.
I've got the following code where I am trying to filter out the range for "TaskID" and then build a string using the values of all the columns or matching rows.
I have two questions really :
1 - How do I refer to each of the column values in the rows collection ?
2 - Is this the best way to do this ?
Thanks in advance.
Craig
I have a named range which is 6 columns wide and (say) 100 rows long.
I've got the following code where I am trying to filter out the range for "TaskID" and then build a string using the values of all the columns or matching rows.
For Each Row In rngComments
If Row.Value = TaskID Then
For j = 1 To 6
strComBuild = strComBuild & "- " & Row.Item(j)
Next j
strComBuild = strComBuild & Chr(13)
End If
Next
I have two questions really :
1 - How do I refer to each of the column values in the rows collection ?
2 - Is this the best way to do this ?
Thanks in advance.
Craig
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In this case I will be using all the columns to form the string, but I would love to know how to refer to a specific column.
Thanks in advance,
Craig