How to use Range property properly?

I’d like to copy like this.

what I was thinking

But, this is what I got

Cell "D2" has problem

My code is quite simple

Range("C1:C2, D1:D2").Value = Range("A1:A2").Value

I just want to copy several cells as a whole into several different places at once using Range propery like this.

Does it has something relationship with Order of Operation ? I mean between "Union Operator"(a Comma) and "Range Operator"(a Colon) within a Range property ?

>Solution :

Range("C1:C2, D1:D2") is a multi-area range.

You need to loop over the .Areas of a multi-area range here:

Dim rng As Range
For Each rng in Range("C1:C2, D1:D2").Areas
   rng.Value = Range("A1:A2").Value

Leave a Reply