[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2017-10-12
3
Low Priority
?
15 Views
Last Modified: 2017-10-12
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
Comment
Question by:Kimberly Helm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 58

Accepted Solution

by:
Bill Prew earned 1000 total points
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
 

Author Closing Comment

by:Kimberly Helm
Ha! Such a small change.  Thank you, very helpful!
0
 
LVL 58

Expert Comment

by:Bill Prew
Welcome.


»bp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Join & Write a Comment

This is an Add-On procedure to be used in conjunction with the code provided in Reducing EE Email Clutter using Outlook (http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3146-Outlook-Processing-EE-emails-on-Receive.…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question