Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Bizzare behavior of IF..THEN

On Tue, 31 Jan 2006 09:24:36 -0600, Myles
wrote:


Hi Ron,

you wrote inter alia:
If you want it to do further testing if a test is false, then you need
to make doing those tests a consequence of the false result.


Since the code exits upon encountering a FALSE evaluation, could you
please give an illustration of how you can base your tests on -a
consequence of the false result-


Thanks

Myles


You need to use the proper syntax. Using either Else or ElseIF for the nested
testing. (See HELP for the IF...Then...Else Statement)

============================
Sub fooD()
If 12 < 5 Then
MsgBox ("12<5")
Else
If 8 10 Then
MsgBox ("810")
Else
If 3 = 3 Then
MsgBox ("3=3")
Else
MsgBox ("other")
End If
End If
End If

End Sub
=============================

This now displays in the message box "3=3"

Or, using the Elseif:

==================================
Sub fooD()

If 12 < 5 Then
MsgBox ("12<5")
ElseIf 8 10 Then
MsgBox ("810")
ElseIf 3 = 3 Then
MsgBox ("3=3")
Else
MsgBox ("other")
End If

End Sub
=================================


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
odd behavior Rich[_8_] Excel Discussion (Misc queries) 2 November 20th 08 10:02 PM
Very odd behavior Kim K Excel Discussion (Misc queries) 2 May 7th 07 12:41 PM
I'm having a bizzare problem with C&P!!!! Marc New Users to Excel 6 April 24th 05 06:29 PM
odd behavior marwan hefnawy Excel Programming 0 September 21st 04 05:15 AM
Bizzare issue with matrix calculations ajames54 Excel Programming 3 February 10th 04 03:29 AM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"