using IF and AND conditions in a macro

I

iamn94

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.
 
B

Bob Phillips

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)
 
N

N10

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
 
T

Toppers

Re Bob's reply:

Set givenCell = Range("H10")

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

Bob Phillips

Thanks, missed that absolute.

--

HTH

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top