[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 34
  • Last Modified:

If... Then... Else with Multiple Actions

Is it possible to create an If...Then...Else statement with multiple actions under "Then" and "Else"?  I currently have the following code:

Dim frstmtgpymnt As Date
Dim lvertn As Boolean

frstmtgpymnt = DateAdd("d", 60, Sheet1.[z1E])

If (cleave1 = True And appleave1 = True And (IsEmpty(Sheet1.[z1DP]) Or Sheet1.[z1DP] > frstmtgpymnt)) Or _
(cleave2 = True And appleave2 = True And (IsEmpty(Sheet1.[z1IU]) Or Sheet1.[z1IU] > frstmtgpymnt)) Or _
(cleave3 = True And appleave3 = True And (IsEmpty(Sheet1.[z1NY]) Or Sheet1.[z1NY] > frstmtgpymnt)) Then _
    lvertn = True
    Sheet5.[A3].EntireRow.Hidden = False
    Sheet5.[A2].EntireRow.Hidden = True
Else
    lvertn = False
    Sheet5.[A3].EntireRow.Hidden = True
    Sheet5.[A2].EntireRow.Hidden = False
End If

Open in new window


I'm getting an Error at Else stating that I can't have an Else without If block (which I do, but perhaps with the wrong syntax).  Thanks in advance for any help.
0
Kimberly Helm
Asked:
Kimberly Helm
  • 2
1 Solution
 
Bill PrewCommented:
Don't continue after the THEN, do as:

Dim frstmtgpymnt As Date
Dim lvertn As Boolean

frstmtgpymnt = DateAdd("d", 60, Sheet1.[z1E])

If (cleave1 = True And appleave1 = True And (IsEmpty(Sheet1.[z1DP]) Or Sheet1.[z1DP] > frstmtgpymnt)) Or _
(cleave2 = True And appleave2 = True And (IsEmpty(Sheet1.[z1IU]) Or Sheet1.[z1IU] > frstmtgpymnt)) Or _
(cleave3 = True And appleave3 = True And (IsEmpty(Sheet1.[z1NY]) Or Sheet1.[z1NY] > frstmtgpymnt)) Then
    lvertn = True
    Sheet5.[A3].EntireRow.Hidden = False
    Sheet5.[A2].EntireRow.Hidden = True
Else
    lvertn = False
    Sheet5.[A3].EntireRow.Hidden = True
    Sheet5.[A2].EntireRow.Hidden = False
End If

Open in new window

0
 
Kimberly HelmAuthor Commented:
Ha! Such a small change.  Thank you, very helpful!
0
 
Bill PrewCommented:
Welcome.


ยปbp
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now