I'm trying to teach myself VBA by programming one of those old 'Choose Your Own Adventure' books in Excel (just for my own fun, not to sell). I have a sheet with a single ActiveX Checkbox ("chkTakeCoins") and a separate command button. These are not in a Userform, they're just on the sheet. I can't figure out how to write the Command Button code to see if chkTakeCoins is true or false. Do I need to Call the chkTakeCoins checkbox from the command button code? As it's written below I get an 'Object required' error.
Sub btn5to147_Click()
If chkTakeCoins.Value = True Then
Sheets("Inventory").Range("coins") = 1
Else
Sheets("Inventory").Range("coins") = 0
End If
Worksheets("147").Activate
End Sub
Help appreciated.
Aucun commentaire:
Enregistrer un commentaire