Hi, Can anyone help me with this. I want to write a formula in column AB if the cell in AA is not blank. The macro below works fine until it hits a blank, the data I have has some blank rows in column AA with more data
below, then another blank and more data. The problem is that it works perfectly until it hits the first blank row and then it stops. Is there a way to loop through the entire column of AA such that the loop that puts a formula in AB will continue until the last non blank cell in AA. Sincere thanks for any help offered.
Code is as follows:
below, then another blank and more data. The problem is that it works perfectly until it hits the first blank row and then it stops. Is there a way to loop through the entire column of AA such that the loop that puts a formula in AB will continue until the last non blank cell in AA. Sincere thanks for any help offered.
Code is as follows:
VBA Code:
' Margin Macro
Dim i As Integer
i = 4
Range("AB4").Select
Do While Not IsEmpty(ActiveCell.Offset(0, -1))
ActiveCell.FormulaR1C1 = _
"=(-RC[-6]/SUM(RC[-24]+RC[-22]+RC[-20]+RC[-18]+RC[-16]+RC[-14]+RC[-12]+RC[-10]+RC[-8]))-1"
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop
End Sub