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

multipe or statements

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

Multipe OR statements?

ResolvedVersion 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:

Hiding a worksheet in Excel

Want to circulate an Excel workbook file but keep certain worksheets hidden from your colleagues' view?

You can do so by bringing up the sheet you wish to hide on your screen; then going to Format - Sheet - Hide.

It will not be immediately obvious that a sheet is hidden from view unless perhaps the sheet are still labelled Sheet 1, Sheet 2 etc.

To display the sheet again, you can go to Format - Sheet - Unhide on any of the other sheets in the workbook. A dialogue box will appear, allowing you to select the hidden sheet/s. Click OK to make the sheet/s reappear again.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.