nested elseif 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 » Nested 'ElseIf' statements

Nested 'ElseIf' statements

resolvedResolved · Low Priority · Version 2003

Graeme has attended:
Excel VBA Intro Intermediate course

Nested 'ElseIf' statements

Can you please advise if there is a limit to the number of 'ElseIf' statements you can nest into a single 'If' > 'End If'?

RE: Nested 'ElseIf' statements

Hi Graeme

Thanks for your question

In principle there is no limit to the number of ELSEif in an if block. I would however recommend using a Select Case block for checking a large number of multiple conditions, as this is easier to maintain and understand

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:

Stop Formula Returning A "#DIV/0" Error

If a formula returns a #DIV/0 error message there is a way to avoid such results.

For example the formula =A1/B1 will return a #DIV/0 if B1 is empty or a zero.

If you protect your formulas with the ISERROR function, the formula will then look like this:

=IF(ISERROR(A1/B1),0,A1/B1)

In plain English: should the result of A1 divided by B1 be an error change the result to 0 else show the result of A1/B1.

View all Excel hints and tips


Server loaded in 0.08 secs.