VBA Help

  • Thread starter Thread starter Lostguy
  • Start date Start date
L

Lostguy

Hello.

I can do this with formulas, but I am getting wrapped around the
syntax for the code which I use with a macro button.

If D11 = "Yes" and D13 = "Same", then if the text in D14 is not equal
to the text in D9, put up a messagebox that says "D14 cannot equal D9.
Please fix, then try again." and stop the macro and allow the user to
make D14 and D9 not equal to each other.

Any help appreciated.

VR/Lost
 
Try

If Range("D11").Value2 = "Yes" And Range("D13").Value2 = "Same" Then

If .Range("D14")>Value2 <> Range("D9").Value2 Then

MsgBox "D14 cannot equal D9. Please fix, then try again."
Else

'do something else
End If
Else

'rest of code
End If

HTH

Bob
 
Bob,

Thanks!

(I never think to make one cell a "range". Range and Value were what I
was missing.)

:)

VR/Lost
 
Back
Top