+ Reply to Thread
Results 1 to 3 of 3

[SOLVED] if then else statement also using "and"

  1. #1
    Amanda
    Guest

    [SOLVED] 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. #2
    Registered User
    Join Date
    08-21-2005
    Posts
    8

    If statement 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

  3. #3
    Registered User
    Join Date
    08-21-2005
    Posts
    8

    IF statement 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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1