IfMacroPrint

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

Guest

I hope that someone can see why the below program segment is not working
properly
I have the following segment of a macro.
The operator from a data validation list selects either NORMAL or IMPAIRED.

I am receiving a printout from sheet "red" when b6 value =NORMAL
BUT when the selection for b6 = "IMPAIRED", the program
bypasses the entry and I do not receive a print out from sheet" green"

Sheets("blue").Range("B6").Select
If Range("B6").Value = "NORMAL" Then
Sheets("red").Range("A8:J81").PrintOut Copies:=1
Range("B2").Select
End If
Sheets("blue").Range("B6").Select
If Range("B6").Value = "IMPAIRED" Then
Sheets("green").Range("A8:J81").PrintOut Copies:=1
Range("B2").Select
End If

thanks for any assistance
 
Hi
first: No need for selections. Use the following
If Ucase(Sheets("blue").Range("B6").Value) = "NORMAL" Then
Sheets("red").Range("A8:J81").PrintOut Copies:=1
elseIf Ucase(Sheets("blue").Range("B6").Value) = "IMPAIRED" Then
Sheets("green").Range("A8:J81").PrintOut Copies:=1
End If

if this does not work then I'd assume that cell B6 contains something
else
 
Hi Mike

Maybe you have a space before the word

Try this line
If Trim(Range("B6").Value) = "IMPAIRED" Then
 
Ron
Works perfectly. Thanks very much. I will remember this advice in
the future as well.
Mike
 
Frank
Thank you for your assistance.
Mike

Frank Kabel said:
Hi
first: No need for selections. Use the following
If Ucase(Sheets("blue").Range("B6").Value) = "NORMAL" Then
Sheets("red").Range("A8:J81").PrintOut Copies:=1
elseIf Ucase(Sheets("blue").Range("B6").Value) = "IMPAIRED" Then
Sheets("green").Range("A8:J81").PrintOut Copies:=1
End If

if this does not work then I'd assume that cell B6 contains something
else
 

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