Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to use the code below to place a single default value into a userform combobox. But I am getting error : "Could not set the value property. Invalid property value." with the line in red. Any help to get past this error will be greatly appreciated.
When the user select a value from combox "league" on the userform a selection of KWMLA executes this (portion of) code.
When the user select a value from combox "league" on the userform a selection of KWMLA executes this (portion of) code.
Rich (BB code):
Case Is = "KWMLA"
Stop
Set nr_calibre = ws_lists.Range("G2:G2") 'range G2:G2 = "REP"
Set nr_dvsion = ws_lists.Range("H33:H38")
t = 2
bigandbad t '{frm_chg_3League}
permit.cbx_calibre.Value = "REP"
VBA Code:
Sub bigandbad(ByRef t As Double)
Dim mycell As Range
If t = 1 Then
'user selects from both calibre and division lists
'prepare calibre
If nr_calibre.Count = 1 Then
permit.cbx_calibre.List = Array(nr_calibre.Value)
Else
permit.cbx_calibre.List = nr_calibre.Value
End If
permit.cbx_calibre.Enabled = True
permit.cbx_calibre.BackColor = clr_blue
'prepare division
If nr_calibre.Count = 1 Then
permit.cbx_division.List = Array(nr_division.Value)
Else
permit.cbx_division.List = nr_dvsion.Value
End If
permit.cbx_division.Enabled = False
chk_main '{frm_permit}*
customer '{frm_activity_reference}*
ElseIf t = 3 Then
'prepare calibre
If nr_calibre.Count = 1 Then
permit.cbx_calibre.List = Array(nr_calibre.Value)
Else
permit.cbx_calibre.List = nr_calibre.Value
End If
permit.cbx_calibre.Enabled = False
'prepare division
If nr_dvsion.Count = 1 Then
permit.cbx_division.List = Array(nr_dvsion.Value)
Else
permit.cbx_division.List = Range("nr_dvsion").Value
End If
permit.cbx_division.Enabled = False
chk_main '{frm_permit}*
customer '{frm_activity_reference}*
ElseIf t = 2 Then
'Stop
'calibre defined, division selectable
'prepare calibre
If nr_calibre.Count = 1 Then
permit.cbx_calibre.List = Array(Range("nr_calibre").Value)
Else
permit.cbx_calibre.List = Range("nr_calibre").Value
End If
permit.cbx_calibre.Enabled = True
permit.cbx_calibre.BackColor = clr_blue
'prepare division
If nr_dvsion.Count = 1 Then
permit.cbx_division.List = Array(Range("nr_division").Value)
Else
permit.cbx_division.List = nr_dvsion.Value
End If
permit.cbx_division.Enabled = True
'permit.cbx_division.BackColor = clr_blue
chk_main '{frm_permit}*
customer '{frm_activity_reference}*
Else 't=4
'variable division based on calibre selection (minor groups with HL & REP)
If nr_calibre.Count = 1 Then
permit.cbx_calibre.List = Array(nr_calibre.Value)
Else
permit.cbx_calibre.List = nr_calibre.Value
End If
permit.cbx_calibre.Enabled = True
permit.cbx_calibre.BackColor = clr_blue
permit.cbx_division.BackColor = vbWhite
permit.cbx_division.Enabled = False
chk_main '{frm_permit}*
customer '{frm_activity_reference}*
End If
End Sub