I have a combo box named "Facility" that has been added as a form control to an Excel 2010 worksheet. I also have a module titled "AdjustmentsAmount" that is running the below method on a form button click. I've tried several methods of accessing the form control, and none work, also listed below. Can anyone shed light on this subject please?
Code
'Clears all run specifications
Sub clearRunSpecs_click()
Dim resp As String
resp = MsgBox("This will clear all run specifications. Are you sure you want to continue?", vbYesNo)
If (resp = vbYes) Then
Worksheets("AdjustmentsAmount").Unprotect "pass"
Range("D3").Clear
Range("D3").Interior.Color = RGB(235, 241, 222)
Range("D3").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("D3").Locked = False
Range("D4").Clear
Range("D4").Interior.Color = RGB(235, 241, 222)
Range("D4").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("D4").Locked = False
Range("B4").Clear
Range("B4").Interior.Color = RGB(235, 241, 222)
Range("B4").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("B4").Locked = False
Range("A17:D22").Clear
Range("A17:D22").Merge
Range("A17:D22").Interior.Color = RGB(235, 241, 222)
Range("A17:D22").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("A17:D22").VerticalAlignment = xlTop
Range("A17:D22").Locked = False
ActiveSheet.Shapes("Facility").ListIndex = -1
ActiveSheet.CheckBoxes("ZeroBalance").Value = xlOff
ActiveSheet.CheckBoxes("Balance<Adj").Value = xlOff
ActiveSheet.CheckBoxes("Balance=Adj").Value = xlOff
Worksheets("AdjustmentsAmount").Protect "pass"
End If
End Sub
Methods tried
ActiveSheet.Shapes("Facility")
ActiveSheet.Facility
ActiveSheet.ListBoxes("Facility")
Application.Facility
I have accessed checkboxes in the same method using ActiveSheet.CheckBoxes("NAME")
and that worked fine. However, I can't seem to get ahold of the combo box.