Results 1 to 2 of 2

Message box that controls running a macro depending on user choice.

Threaded View

  1. #1
    Registered User
    Join Date
    10-30-2003
    Location
    Merley, United Kingdom
    Posts
    1

    Message box that controls running a macro depending on user choice.

    Hello , I am new to creating macros. can someone please let me know where I am going wrong. I have an excel workbook for Timesheets and have setup a macro clears all tick boxes. but would like to give the user the options of yes or no prior to running the macro.

    Here is the simple code:

    Sub ClearCheckBoxes()
    
      Dim ChkBox As Object
      Dim Wks As Worksheet
      
      if MsgBox ( prompt = "Warning this will clear Timesheet Data, would you like to Continue?",
            Buttons = vbYesNo + vbQuestion, _
            Title = "Clear TimeSheet Data" )= vbNo then
            Exit Sub
        End If
       
        For Each Wks In Worksheets
          For Each ChkBox In Wks.CheckBoxes
            ChkBox.Value = xlOff
          Next ChkBox
        Next Wks
    
    End Sub
    I get syntax error can anyone please help?

    Thank you
    Last edited by arlu1201; 07-16-2013 at 07:12 AM. Reason: Use code tags in future.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Multiple Time Stamps depending on choice in Drop Down List Choice
    By insayah in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-25-2022, 09:53 AM
  2. ActiveX controls disappearing while running a macro
    By darry in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-20-2013, 06:41 AM
  3. [SOLVED] User's choice to several checkbox options will place user name on selected worksheets
    By SLJones in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2013, 12:03 PM
  4. [SOLVED] Start Macro after user selects a choice from a pick list
    By Mathew in forum Excel General
    Replies: 2
    Last Post: 08-17-2006, 10:30 AM
  5. [SOLVED] Running a Macro depending on Validation List Selection
    By Fester in forum Excel General
    Replies: 4
    Last Post: 04-26-2005, 05:06 PM

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