excel vba combine ranges

The solution for “excel vba combine ranges” can be found here. The following code will assist you in solving the problem.

With Sheet1
Set rng1 = .Range(“A1:A3”)
Set rng2 = .Range(“C1:C3”)

‘This combines the two separate ranges, so select A1, A2, A3, C1, C2, C3
set newRng = Union(rng1, rng2)

‘This combines the two ranges in the same way as when using “A1:C3”,
‘so including the cells from column B
set newRng = .Range(rng1, rng2)

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts