Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Amanda
 
Posts: n/a
Default if then else statement also using "and"

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....
  #2   Report Post  
Ashley Frank
 
Posts: n/a
Default if then else statement also using "and"


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


--
Ashley Frank
------------------------------------------------------------------------
Ashley Frank's Profile: http://www.excelforum.com/member.php...o&userid=26488
View this thread: http://www.excelforum.com/showthread...hreadid=483378

  #3   Report Post  
Ashley Frank
 
Posts: n/a
Default if then else statement also using "and"


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

ashley


--
Ashley Frank
------------------------------------------------------------------------
Ashley Frank's Profile: http://www.excelforum.com/member.php...o&userid=26488
View this thread: http://www.excelforum.com/showthread...hreadid=483378

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Long IF Statement rmitchell87 Excel Discussion (Misc queries) 2 October 2nd 05 03:50 AM
IF Statement problem trixma New Users to Excel 3 September 27th 05 06:36 AM
If statement Matt Montagliano Excel Discussion (Misc queries) 1 September 8th 05 08:47 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM


All times are GMT +1. The time now is 03:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"