+ Reply to Thread
Results 1 to 4 of 4

If Checkbox is Ticked and Cell has Value then Run Macro

  1. #1
    Registered User
    Join Date
    05-31-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    If Checkbox is Ticked and Cell has Value then Run Macro

    Hi Guys

    I am really stuck here. I want to add code for checkbox/cell validation in the code below. I want the user to tick yes or no tickbox. And if user ticks yes, then user should put value in Cell.

    If Cell has value but yes is not ticked then message (please tick yes)
    If Cell doesn't have value but Yes is ticked then message (please put value)

    If Cell has value and Yes is ticked Or
    if Cell doesn't have value and Yes is not ticked then run macro

    Please find attached file and kindly help asap if possible.

    Please Login or Register  to view this content.
    Many thanks
    Heaven

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: If Checkbox is Ticked and Cell has Value then Run Macro

    Hi Heaven

    See if the attached works for you. I'm old and still believe in the GoTo statement in VBA. Most "REAL" programmers won't use it, but it works for me.

    I linked your checkboxes to the cells behind them and made the font white on white. This allowed useing the cell value instead of the checkbox value in the if statement.

    I didn't completely finish your code but showed how I'd do the first parts. I think you can get it from here.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    05-31-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: If Checkbox is Ticked and Cell has Value then Run Macro

    Hi MarvinP

    Many thanks for your help. It worked. I will also paste another solution as well.

    Do you know how to lock certain Ribbon controls. For example, insert-Text. or headfooter.

    Many thanks,
    Hamid.
    Using Excel 2007

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: If Checkbox is Ticked and Cell has Value then Run Macro

    I don't understand the question of "Lock Ribbon Controls?" but it sounds like you may need to study the "QAT". This is the Quick Access Toolbar and allows you to make your own Icons above the Ribbon to do things not on the Ribbon already.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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