VBA Help

Associate
Joined
2 Jun 2004
Posts
754
Location
Space
Hi there,

I've created a search userform on Excel VBA and I'm stuck on the If Else statement.

I have coded it so that I can search for the Data, however I can't get my head around so that if there is missing information, it will display a message on the field saying something like (Information Missing). Can anyone help? I've googled but I can't seem to get it right.


Code:
Private Sub cmdSearch_Click()

row_number = 0
Do
DoEvents

row_number = row_number + 1
item_in_review = Sheets("Search").Range("A" & row_number)
    
If item_in_review = cboBranchNumber.Text Then
    
    txtStore.Text = Sheets("Search").Range("B" & row_number)
    txtFormat.Text = Sheets("Search").Range("C" & row_number)
    txtManager.Text = Sheets("Search").Range("D" & row_number)
    txtNumber.Text = Sheets("Search").Range("E" & row_number)
    txtGroup.Text = Sheets("Search").Range("F" & row_number)
    txtSd.Text = Sheets("Search").Range("G" & row_number)
    txtOd.Text = Sheets("Search").Range("H" & row_number)
    txtGroupFm.Text = Sheets("Search").Range("I" & row_number)
    
End If


Loop Until item_in_review = ""


End Sub
 
Associate
OP
Joined
2 Jun 2004
Posts
754
Location
Space
Thanks for the response! I'll give this a try first thing in the morning and I'll let you know how I get on.

I'm trying now to learn what you have included so I know for future reference.

I'm new to VBA so I really appreciate the time helping me out.

PS I have used textbox!
 
Associate
OP
Joined
2 Jun 2004
Posts
754
Location
Space
I have one final question...

I'm hoping to do develop a tool for work and I know that you can open the program up from the desktop as appose to needing it run from excel. Would you know how to do this?

Many thanks.
 
Back
Top Bottom