Good Morning - I have a worksheet in excel with about 20 checkboxes and I will like to set the value of each checkboxes on the click of a button without having to spell out the name of each checkboxes. Is this possible. I know in Visual Basic I can create an array of checkboxes. But I don't know how to do this in excel vba. I created each checkbox separetly. Thanks.
Dim myU, myP, strCB
'equipments for UA-AAL1
myU = Array(chkPP8600.Name, chkCMT.Name, chkMDM.Name,
chkPP15k.Name, chkSAM21.Name, chkGWC.Name,chkMG9kEM.Name)
myP = Array(chkPP8600.Name, chkCMT.Name, chkMDM.Name,
chkPP15k.Name, chkSAM21.Name, chkGWC.Name, _
chkIWSPM.Name, chkDPTSPM.Name,)
If optmyU.Value = True Then
For Each strCB In myU
Controls(strCB).Value = True
Next
elseif optmyP.value = true then
For Each strCB In myP
Controls(strCB).Value = True
Next
else
end if
Dim myU, myP, strCB
'equipments for UA-AAL1
myU = Array(chkPP8600.Name, chkCMT.Name, chkMDM.Name,
chkPP15k.Name, chkSAM21.Name, chkGWC.Name,chkMG9kEM.Name)
myP = Array(chkPP8600.Name, chkCMT.Name, chkMDM.Name,
chkPP15k.Name, chkSAM21.Name, chkGWC.Name, _
chkIWSPM.Name, chkDPTSPM.Name,)
If optmyU.Value = True Then
For Each strCB In myU
Controls(strCB).Value = True
Next
elseif optmyP.value = true then
For Each strCB In myP
Controls(strCB).Value = True
Next
else
end if