jeudi 23 juin 2016

Running a macro only when a checkbox is checked, and having it revert to a set "normal" state when each checkbox is unchecked

So I am trying to create checkboxes that insert pre-calculated data into a table when a checkbox is "checked" and have that same checkbox have the ability to allow the spreadsheet to go back to the state before the checkbox was clicked. I have been trying to see whether its possible on my own for the last couple days but can't seem to find any concrete answers. An example code I have so far is

    .   Sub XrayWeld()
    '
    ' XrayWeld Macro
    '

    '
      Range("O7").Select
        ActiveCell.FormulaR1C1 = _
             "=((RC[-6]*'Table Data'!R[1]C[-8])+(RC[-5]*'Table Data'!R[1]C[-6])+(RC[-4]*'Table Data'!R[1]C[-5])+(RC[-3]*'Table Data'!R[1]C[-4])+(RC[-2]*'Table Data'!R[1]C[-2])+(RC[-1]*'Table Data'!R[1]C[-1]))"
        Range("O7").Select
        Selection.AutoFill Destination:=Range("O7:O30"), Type:=xlFillDefault
        Range("O7:O30").Select
        Sheets("Calculator Form ").Select
        Range("O32").Select

     End Sub




Aucun commentaire:

Enregistrer un commentaire