Want to understand a code line

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
I have a code whose 4 lines are:

Rich (BB code):
If a(q) > 0 Then
findhigh = Format(a(q), "0.00")
GoTo finish
End If

I want to understand, If a(q)<=0 Then WHAT WILL HAPPEN?
  • Will GoTo finish line get ‘activated’?
  • 2nd line will not be activated?
  • i.e. IF the If condition…is not TRUE Then does it works as
Rich (BB code):
Else If GoTo finish

Thanks in advance
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
If a(q)>0 (true), the code then performs both lines before the End If statement, including GoTo finish.

If a(q)<=0 (not true), the code will not process either of those lines and simply move on to the next line of code after the End If statement.
 
Upvote 0
If a(q)>0 (true), the code then performs both lines before the End If statement, including GoTo finish.

If a(q)<=0 (not true), the code will not process either of those lines and simply move on to the next line of code after the End If statement.
Do you mean that If a(q)>0 (TRUE), the code will perform the 2nd line FIRST & THEN ONLY (ACTION NUMBER 2) it will perform the 3rd line.
PLUS in my above 4 lines, can you please add "Else If" line......for my better understanding of If ...Then.... ElseIf..... End If
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top