View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les[_7_] Les[_7_] is offline
external usenet poster
 
Posts: 3
Default VBA macro Cell argument

HELP PLEASE: trying to compare the result of a cell formula in Cells(A, "C") its contains the result of a Vlookup, I am trying to look for < with another cell Cells(A, "E") the macro runs once then locks up error code 2042. Anyone any ideas please? Or better code !!!

Sub CellCompare()
Dim A As Integer
A = 1
Sheets("NIMROD001").Select
Do Until IsEmpty(Cells(A, "B"))
If Cells(A, "C") < Cells(A, "E") Then ' Doesnt like formulae
Rows(A).Copy
Sheets("Sheet1").Select
Cells(ActiveCell.Row + 1, 1).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("NIMROD001").Select
End If
A = A + 1
Loop
End Sub