How to connect a range object to a formula

I want to include a range object in a formula. An example should look something like this:

Dim x As Range Set x = Range(Cells(1, 1), Cells(2, 1)) Range("C1").Formula = "=SUM(" & x & ")" 

In cell C1, the result should be "= SUM (A1: A2)".

The goal is to connect the range object to the formula. As an example, I used SUM, the real formula is more complicated.

I think there is a simple answer to this question, for example. some method for a range object, but I did not find it after some reflection ...

Thanks in advance, Dainis

+4
source share
2 answers

Use x.address, which should do the trick

0
source

Source: https://habr.com/ru/post/1301697/


All Articles