if then else statement also using "and"

G

Guest

I am trying to use the following but it isn't working properly. Can someone
please advise what I am doing wrong?

If Sheets("E").Range("C8").Value = "1" And Sheets("E").Range("C2").Value =
"Yes" Then
Sheets("1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ElseIf Sheets("E").Range("C8").Value = "1" And
Sheets("E").Range("C2").Value = "No" Then
Sheets("1").Select
Rows("24:27").Select
Selection.Delete Shift:=x1Up
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Else
Sheets("STEP 2").Select
End If

Any help would be greatly appreciated....
 
A

Ashley Frank

Amanda,

I have modified your code to show how it should be written

If Range("E2") And Range("F2").Value = "1" Then
Range("A1").Select

End sub
End If
'
End Sub

Ashley
 
A

Ashley Frank

Amanda,

Sorry, mis-understood. It should be

If (Range("E2").Value = "1") And (Range("F2").Value = "YES") Then
Range("A1").Select
Else
End If
'
End Sub

ashle
 

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

Similar Threads


Top