using IF and AND conditions in a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

As part of the macro that I am writing, I need to set up two conditions for
a given cell, ie: if the value is less than zero AND its abolute value is
greater than x, then enter the text string "N/A" into the cell.

Any thoughts on how this can be done. New to macro writing so this one has
me stumped.

thanks for any help that the group can provide.
 
Set givenCell = Range("H10")

If givenCell.Value < 0 And givenCell.Value > x Then
givenCell.Value = "N/A"
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
iamn94 said:
Hello:

As part of the macro that I am writing, I need to set up two conditions
for
a given cell, ie: if the value is less than zero AND its abolute value is
greater than x, then enter the text string "N/A" into the cell.

Any thoughts on how this can be done. New to macro writing so this one
has
me stumped.

thanks for any help that the group can provide.

HI

Does X have a value?

Best N10
 
Re Bob's reply:

Set givenCell = Range("H10")

If givenCell.Value < 0 And Abs(givenCell.Value ) > x Then
givenCell.Value = "N/A"
End If
 
Thanks, missed that absolute.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top