Search code examples
excelexcel-2010

how to check the box automatically when two cell values are checked


I have two sheets in sheet1 there is a checkbox for Assign grades which i only wanted to be checked automatically if the giving three check boxes (Math physics chemistry) in another sheet2 are checked, if any of the checked box in sheet2 are not checked then I do not check the assign value theses are two separate sheets


Solution

  • With this macro works

    Private Sub CHECKBOXES()
    If ThisWorkbook.Worksheets(2).CHECKBOXES("Check Box 1").Value = xlOn And ThisWorkbook.Worksheets(2).CHECKBOXES("Check Box 2").Value = xlOn And ThisWorkbook.Worksheets(2).CHECKBOXES("Check Box 3").Value = xlOn Then
    ThisWorkbook.Worksheets(1).CHECKBOXES("Check Box 1").Value = xlOn
    Else
    ThisWorkbook.Worksheets(1).CHECKBOXES("Check Box 1").Value = xlOff
    End If
    End Sub
    

    Just need to save the macro and run it when you want.