Loop never ends
Dear Useless,
Forget looping, do it directly. Something like this will work, though you
never said what your lookup formula actually was, so the .Formula line will
need to be adjusted: post back if you can't figure out the necessary
changes:
Sub MacroForUseless()
With Intersect(Columns("AC:AD"), ActiveSheet.UsedRange)
.AutoFilter Field:=1, Criteria1:="<"
With .Columns(2).SpecialCells(xlCellTypeVisible)
.Formula = _
"=VLOOKUP(A" & .Row & ",$B$1:$C$100,2,False)"
End With
.AutoFilter
End With
End Sub
HTH,
Bernie
MS Excel MVP
"useless at looping!" <useless at wrote
in message ...
I have a macro that I run every month which calculates commission and one
of columns in my spreadsheets uses vlookup. I would like the macro to paste
the vlookup command I am using into cells in column AD only if the cell in
column AC is not blank. I have tried creating loops but they either stop
after pasting into the first cell or continue on forever.
Anyone who can help? It would be greatly appreciated!!!
|