vba Loop over a non-contiguous range

Posted by Jeffrey on Stack Overflow See other posts from Stack Overflow or by Jeffrey
Published on 2010-04-02T17:34:17Z Indexed on 2010/04/02 18:53 UTC
Read the original article Hit count: 213

Filed under:
|

I have a non-contiguous range on rows (example address of myRange: $2:$2,$4:$205,$214:$214) and I would like to access a specific row and column within the range. I have tried the following:

'Get the value of the 2nd row, 1st column within the range

myRange.rows(2).Cells(, 1).Value

However, this is giving me the value of the 2nd row in the WorkSheet, and NOT in the range - meaning it is giving me address $3$1 - and not $4$1

Can someone please explain how I can access the values within in my range? (It may have to do with different areas)

Thank You

© Stack Overflow or respective owner

Related posts about vba

Related posts about excel