Hi Monk,
I missed the formula value too. Anyways here's some examples for you:
Puts SAME formula in each cell, Not what you want I don't think
Option Explicit
'Your version
Sub Same()
'-- Selecting Column to begin "Do Loop-Until" to insert formula --
Range("AM2").Select
'not needed
'ActiveCell.FormulaR1C1 = "=IF(AND(AH2="""",AI2="""",AJ2>=AE2),1,"""")"
Do
With ActiveCell
.Formula = "=IF(AND(AH2="""",AI2="""",AJ2>=AE2),1,"""")"
.Offset(1, 0).Select
End With
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
'-- End Loop --
End Sub
Sub ColumnSame()
'My version
Dim cel As Range
Dim rng As Range
Dim LastRow As Long
'Get last row of data Column AN
LastRow = Range("AN65536").End(xlUp).Row
'Create object
Set rng = Range("AM2:AM" & LastRow)
'//Same formula in each cell
'Use For Each (faster)
For Each cel In rng
cel.Formula = "=IF(AND(AH2="""",AI2="""",AJ2>=AE2),1,"""")"
Next cel
'-- End Loop --
'Destroy objects
Set cel = Nothing
Set rng = Nothing
End Sub
Puts progressive formula in each cell
Option Explicit
Sub Diff()
'Yours
Dim counter As Long
'-- Selecting Column to begin "Do Loop-Until" to insert formula --
Range("AM2").Select
'not needed
'ActiveCell.FormulaR1C1 = "=IF(AND(AH2="""",AI2="""",AJ2>=AE2),1,"""")"
'Init
counter = ActiveCell.Row
Do
With ActiveCell
.Formula = "=IF(AND(AH" & counter & "="""",AI" & counter & "="""",AJ" & counter & ">=AE" & counter & "),1,"""")"
.Offset(1, 0).Select
counter = ActiveCell.Row
End With
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
'-- End Loop --
End Sub
Sub ColumnDifferent()
'Mine
Dim cel As Range
Dim rng As Range
Dim counter As Long
Dim LastRow As Long
'Get last row of data Column AN
LastRow = Range("AN65536").End(xlUp).Row
'Create object
Set rng = Range("AM2:AM" & LastRow)
'Init counter
counter = 2
'//Same formula in each cell
'Use For Each (faster)
For Each cel In rng
cel.Formula = "=IF(AND(AH" & counter & "="""",AI" & counter & "="""",AJ" & counter & ">=AE" & counter & "),1,"""")"
counter = counter + 1
Next cel
'Destroy objects
Set cel = Nothing
Set rng = Nothing
End Sub