+ Reply to Thread
Results 1 to 2 of 2

Excel vba IF THEN ELSE statement

  1. #1
    Registered User
    Join Date
    05-09-2019
    Location
    Chicago, IL, USA
    MS-Off Ver
    Office 365, Excel
    Posts
    1

    Excel vba IF THEN ELSE statement

    Hi. I have two Subs: one inserts a shape ("Checkmark") on top of another shape, a square, and

    one erases a shape ("Checkmark") when it is selected.

    When a user double-clicks on a particular square, one of two things must happen:

    a) If the square is empty, a checkmark gets inserted into the square;

    b) If the square already has a checkmark in it, the checkmark gets erased.

    My problem is: I'm having trouble writing an If Then Else statement that works!

    If there's no checkmark in the square, then insert one;

    Else

    If the square contains a checkmark, erase it.

    Both of the existing subs work properly. The _BeforeDoubleClick_ action also works fine. But I can't make the If Then Else statement work properly. Help, please! Thank you.

    The existing subs:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 05-09-2019 at 12:53 PM. Reason: Please us code tags!

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Excel vba IF THEN ELSE statement

    Use Select Case statement.
    Why do you need a shape of a checkmark, you've got a font (use Marlett or Windings or one of those)
    Sample?
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel if statement
    By JohnboyKGS in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-02-2015, 11:21 PM
  2. Why and If statement works in Excel 2007 but fails to work in Excel 2010?
    By Superfly1984 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-03-2013, 08:26 AM
  3. Excel IF Statement
    By acroukamp in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2012, 06:15 PM
  4. help with excel if statement please
    By britt.govols in forum Excel General
    Replies: 2
    Last Post: 09-07-2006, 02:07 PM
  5. Replies: 2
    Last Post: 03-17-2006, 11:00 PM
  6. [SOLVED] SQL Statement and Excel
    By DavidM in forum Excel General
    Replies: 3
    Last Post: 01-07-2005, 09:06 AM
  7. [SOLVED] SQL Statement and Excel
    By DavidM in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-07-2005, 09:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1