Results 1 to 4 of 4

Excel 2007 : Running a macro using an if function

Threaded View

Sky188 Running a macro using an if... 06-01-2012, 11:41 AM
tigeravatar Re: Running a macro using an... 06-01-2012, 12:24 PM
Sky188 Re: Running a macro using an... 06-01-2012, 03:09 PM
tigeravatar Re: Running a macro using an... 06-01-2012, 03:14 PM
  1. #1
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Running a macro using an if function

    Greetings fellow earthlings!

    I'm trying to create a form with check boxes that causes a macro to be run when a check box is checked. I've done a bit of research on the matter and have come to the conclusion that the best way to do this is to use a function similar to the below:

    Sub "sheet name" ()
    If A1 = 1 Then
    Run (["insert macro name")
    Else
    End Sub
    This function works, as if A1 doesn't = 1 the macro will not run, but it will run if A1 does = 1. The issue I am having is getting it to run when I want it to run.

    To elaborate a bit to my specific case:
    If I have a check box in A1 that returns the values "true" if checked and "false" if not checked to A2,
    and I want to hide cells A4-A7 when the A2=True, and unhide them when A2=false,
    how would I go about this?
    Last edited by Paul; 06-01-2012 at 03:17 PM. Reason: Added CODE tags for new user. Please do so yourself in the future.

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