Non Contiguous Range of Cells - Name Problem

  • Hi,

    I have trouble with the following problem.
    If I want to refer two groups of ranges, say A1:E3 and G5:H9, then I would use
    Range("A1:E3, G5:H9")

    I also know that Range(Cells(1,2),Cells(4,5)) would refer to Range("B1:E5")

    How can I refer to something (non contiguous range) using the numeric method?
    Intutively, I thought it would be Range([Cells(1,2),Cells(4,5)],[Cells(3,4),Cells(3,5)]) but it's not correct.

    Any help is greatly appreciated! Thanks!


  • Sub ranges()
    Set myRange = Union(Range(Cells(1, 1), Cells(5, 5)), Range(Cells(7, 7), Cells(9, 9)))
    End Sub

    'clumsy, but it works.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!