ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loop variable range (https://www.excelbanter.com/excel-programming/433892-re-loop-variable-range.html)

Jim Thomlinson

loop variable range
 
I misread the question...

Dim rng As Range

For Each rng In Range("D1:S1")
If rng.Offset(2, 0).value + rng.Offset(4, 0).value rng.Value Then
MsgBox rng.Address
End If
Next rng

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

One way...

Dim rng As Range

For Each rng In Range("D1:S1")
If Application.Sum(rng.Offset(2, 0).Resize(3, 1)) rng.Value Then
MsgBox rng.Address
End If
Next rng
--
HTH...

Jim Thomlinson


"CR" wrote:

I have a Range with values D1:S5

I need to sum D3 and D5 and if it is D1 value then
Do something

Then loop through E to S, doing the same thing

Any help would be appreciated

Thanks
CR





All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com