multipe or statements

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Multipe OR statements?

Multipe OR statements?

resolvedResolved · Urgent Priority · Version 2003

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

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Create a unique items table from a duplicating table

1. Ensure that your list has column headings
2. Select the entire list
3. From the menu bar, select DATA, FILTER, ADVANCED FILTER
4. Select "Filter the list, in place", and tick the "Unique Records Only" box
5. Click OK, filtered list appears.

View all Excel hints and tips


Server loaded in 0.08 secs.