I have two ranges, each containing a single cell (for example "A1" and "C3").
How do I get a new range containing all the cells between these two ("A1:C3")?
I tried this:
Set NewRange = Range(Range1.Address:Range2.Address)
Also how do I set a range in R1C1 format? I want to use something like Range("R1C2") instead of Range("A2").
You can set the a new range in various ways. Below are a few examples. To get R1C1 format - I personally find it easier entering the normal formula and then using VBA to extract the R1C1 format required. See the debug.print statements below.
It´s also possible something like:
Like this?
Instead of R1C1 format use
Cells(r,c)
. That will give you more flexibility + controlSo
Range("A2")
can be written asCells(2,1)
Put this in a module:
Use it like:
Method 4 is not the same as Method 1 when the ranges are not adjacent.