Search code examples
excelvba

VBA Checkbox with 2 cells for reference


I have 4 different checkboxes with the same text "OTHER" but in different sections: Really Low, Low, Middle and High. I need the checkbox in the correct section to be checked if its reference cell has the value "Other" and the second reference cell has the value of its section (Really Low, Low, Middle and High).

Currently, I have the following VBA for just one cell reference that works correctly but now need to add another reference value.

Sheets("Sheet1").CheckBox48.Value = Sheets("Sheet2").Cells(i, "ah") = "Other"


Solution

  • Tim Williams' comment below answered my question.

    Sheets("Sheet1").CheckBox48.Value = Sheets("Sheet2").Cells(i, "ah").Value = "Other" And Sheets("Sheet2").Cells(i, "ai").Value = "Low"