if this than that macro

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

Guest

I need a macro that will find and place (similar to an if statement)
ex: =if 1 = 1, "1" , if 1 = 2," 2","3"

however, i also need to say if 1 does not equal 1 or 2 etc then 0
 
Do you mean

If Range("A1").Value = 1 Or Range("A1").Value = 2 Then
Range("B1").Value = Range("A1").Value
Else
Range("B1").Value = 0
End If

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
In column C

if there is an A, i want to replace with 1
if there is a B, I want to replace with 2
if there is an C, i want to replace with 3
if there is a D, I want to replace with 4

Any other letter, i want to replace with 0
 
You could use a case select property:

Select case letterx

case A
cell.value = 1 (not sure if that is right, but you get the idea)

etc

end select

regards,

mike
 
does not work for what I am trying to do

mike said:
You could use a case select property:

Select case letterx

case A
cell.value = 1 (not sure if that is right, but you get the idea)

etc

end select

regards,

mike
 

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

Back
Top