IF help

  • Thread starter Thread starter Paige
  • Start date Start date
P

Paige

Hello, I am trying to do some IF statements within a larger macro.
What I want to do is delete certain sections of a worksheet dependin
on whether they have quantities in them or not. I got an IF statemen
to work, but it carried what it needed to do if it was true whether i
was true or false. Right now I have it set up to just change th
background color until I know for sure it works because it helps m
keep track of what is working & not working while I am building th
macros. Below is an example of the IF statments that I can't get t
work the way I want. This is my first attempt at them so they may b
completely wrong.

If R2 = 0 Then
Range("A288:A334").Select
Selection.Interior.ColorIndex = 4
End If

If Q2 = 0 Then
Range("A240:A287").Select
Selection.Interior.ColorIndex = 14
End If

If P2 = 0 Then
Range("A192:A239").Select
Selection.Interior.ColorIndex = 39
End If

Thanks for any help
 
Should it be?

If Range("R2").Value = 0 Then
Range("A288:A334").Interior.ColorIndex = 4
End If

If Range("Q2").Value = 0 Then
Range("A240:A287")..Interior.ColorIndex = 14
End If

If Range("P2").Value = 0 Then
Range("A192:A239")..Interior.ColorIndex = 39
End If
 

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