Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple Macros (excel2003)

    How do you Assign Multiple Macros to a Single Function. For Example If i wanted to Make a list with checkboxes, how would i go about making it so when i check the box every thing in that line strikes through? and how do I get it to where if i uncheck the same box the text returns to normal? Please Let me know.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Macros (excel2003)

    Let's assume you used a checkbox from the forms toolbar and have attached that checkbox to a macro named "Strike":

    <pre>Sub Strike()
    With ActiveSheet.CheckBoxes(Application.Caller)
    ActiveSheet.Rows(.TopLeftCell.Row).Font.Strikethro ugh = (.Value = 1)
    End With
    End Sub
    </pre>

    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Macros (excel2003)

    You'd use a single macro and check the state of the check box. One option is to use If ... Then ... Else ... End If:
    <code>
    If ActiveSheet.Shapes("Check Box 1").ControlFormat.Value = 1 Then
    Range("A1:F1").Font.StrikeThrough = True
    Else
    Range("A1:F1").Font.StrikeThrough = False
    End If
    </code>
    This assumes that you have used a check box from the Forms toolbar. The above code can be shortened to
    <code>
    Range("A1:F1").Font.StrikeThrough = (ActiveSheet.Shapes("Check Box 1").ControlFormat.Value = 1)
    </code>
    If the check box is from the Control Toolbox, the code is slightly differently.

    PS Was the reply to <post#=651,831>post 651,831</post#> helpful?

Posting Permissions

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