Hermanator
Technical User
Hello,
This is what I'm trying to achieve: I have a worksheet with 2 columns of data as follows:
1 A B
2 2 243
3 1 12
4 0 55
5 -1 1
6 -2 23
7 -3 12
I want to perform some calculations on these values, but only on the negative X-values. I can set a range in VBA, that contains all used cells of columns X and Y containing the data (A1:B7). It is ofcourse possible to find the start and end of the range of negative values and create a new range that way (A5:B7), however the negative range is not necessarily continuous.
Is there a way to automatically create a new range, containing only those values with X<0 ? I have tried already to use the "Filters" propery, but that enables the "AutoFilter" function on the worksheet. Is there a way to filter a range using VBA, that leaves the worksheet unaffected?
Thank you
This is what I'm trying to achieve: I have a worksheet with 2 columns of data as follows:
1 A B
2 2 243
3 1 12
4 0 55
5 -1 1
6 -2 23
7 -3 12
I want to perform some calculations on these values, but only on the negative X-values. I can set a range in VBA, that contains all used cells of columns X and Y containing the data (A1:B7). It is ofcourse possible to find the start and end of the range of negative values and create a new range that way (A5:B7), however the negative range is not necessarily continuous.
Is there a way to automatically create a new range, containing only those values with X<0 ? I have tried already to use the "Filters" propery, but that enables the "AutoFilter" function on the worksheet. Is there a way to filter a range using VBA, that leaves the worksheet unaffected?
Thank you