Thread: Multiple Thens
View Single Post
Old Feb 14th, 2006, 7:42 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Okay. That's not correct. "And" is a logical function which makes it part of the expression being dealt with in evaluating the THEN, not a separate path of execution. Here's an actual example:
    If name = "" Then

        result = MsgBox("     Name required for replace operation     ", , "Error")

    ElseIf oldRow <> newRow Then

        result = MsgBox("     Name and row don't agree     " + Chr(13) + "        Clear the row number     ", vbOKOnly, "Problem With Find")

    Else:

        For counter = 1 To 13
            If counter <> 55 Then

                Set curCell = Worksheets("Sheet1").Cells(counter, 2)
                myVal = curCell.Value
                Set curCell = Worksheets("Sheet1").Cells(newRow, counter)
                curCell.Value = myVal

            End If
        Next counter
    End If
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote