Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Whats wrong with this IF

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Private Sub CommandButton1_Click()
    If TextBox1 = "" Then
    Call Search_productnumber(TextBox2)
    If TextBox2 = "" Then
    Call Search_productname(TextBox1)
    Else
    Call Search_productname(TextBox1)
    Call Search_productnumber(TextBox2)
    End If
    End If
    End Sub

    This If statement is supposed to search either textbox1 or textbox2 on a userform when the command button is clicked. I can't see what is wrong with it, could someone please help!

  2. #2
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    813
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    elseIf in 4. line of your code

    Private Sub CommandButton1_Click()
    If TextBox1 = "" Then
    Call Search_productnumber(TextBox2)
    elseIf TextBox2 = "" Then
    Call Search_productname(TextBox1)
    Else
    Call Search_productname(TextBox1)
    Call Search_productnumber(TextBox2)
    End If
    End If
    End Sub


    Regards
    Suat

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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