Angela has attended:
Excel VBA Intro Intermediate course
Multipe OR statements?
Hi
I'm creating a user form and i want when the user click a button it will show a list of items that they have selected from a previous sheet with boxes.
So How do I write a code for multiple 'OR' staments
for example I want to say if
Cell A2 = true then dsiplay contents of cell E2, if Cell A3 is true then display contents of E3 etc...
At the end they should have a list of items on the user form.
I can get one item to show with this code
Private Sub cmdAdd_Click()
Set ws = Worksheets("Exchange Input")
ws.Visible = True
If Range("A2").Value = True Then
Me.txtExchanges.Value = Range("E2")
End If
End sub
If I add multiple if statements, if all the cells are true only one item is listed on the form.
RE: multipe OR statements?
Hi Angela
Thank you for your question
It is difficult to advise without seeing your spreadsheet directly.
My first thought however is that ratherthan using an OR statement, a better approach might be a SELECT CASE structure.
I suggest you try this.
If this doesnt work perhaps you could email me the spreadsheet in question and I will look into it
Regards
Stephen