tpkelley_no
Board Regular
- Joined
- Oct 14, 2011
- Messages
- 183
- Office Version
-
- 2010
- Platform
-
- Windows
I need the following formula in VBA code =if(E242<>0,D242+E242,0). The formula needs to be placed in column “I”. Where column “B” has “LB” and “LB” can be in any row in column “B” I came up with the following and it did not work.
Code:
Sub test()
Dim i As Long, LRT As Long
LRT = Range("B" & Rows.Count).End(xlUp).Row
For i = LRT To 1 Step -1
If Cells(i, 2).Value = "LB" Then
Cells(i, 8).Formula = "=if(" & Range("b6:b" & LRT <> 0)("d6:d" & LRT + "e6:e" & LRT).Address&
End If
Next
End Sub