Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to assign a userform combobox a list based on a predefined named range of cells with the code below. The line in red is giving me an error: "Could not set the list property. Invalid property array index."
Is anyone able to help me correct this error? I apologize if this is the same problem, or similar to the one I posted here. I feel it's similar, but not quite sure how and I haven't quite figured out how it all relates.
Rich (BB code):
Sub ref_activity()
Dim chng As Double, cnt As Double
Dim df_other1 As String
Dim nm_shut As Range, nm_gen As Range, nm_pas As Range, nm_lcs As Range, nm_hyd As Range, nm_wtr As Range, nm_ph As Range ', nm_exp135 As Range, nm_exp136 As Range
Dim r As Integer, prow As Integer
'define default names for activity fields
ActiveWorkbook.Names.Add Name:="nm_shut", RefersTo:=ws_lists.Range("M2:M4")
ActiveWorkbook.Names.Add Name:="nm_gen", RefersTo:=ws_lists.Range("Y2:Y4")
ActiveWorkbook.Names.Add Name:="nm_pas", RefersTo:=ws_lists.Range("N2:N4")
ActiveWorkbook.Names.Add Name:="nm_lcs", RefersTo:=ws_lists.Range("N2:N4")
ActiveWorkbook.Names.Add Name:="nm_hyd", RefersTo:=ws_lists.Range("O2:O4")
ActiveWorkbook.Names.Add Name:="nm_wtr", RefersTo:=ws_lists.Range("O2:O4")
ActiveWorkbook.Names.Add Name:="nn_ph", RefersTo:=ws_lists.Range("O2:O4")
If permitexists = True Then 'rental exists, populate data
Stop
'prmt_exists
'MsgBox "Are buttons accessible and operable?"
Else 'permit doesn't exist
'Stop
str_activity = permit.cbx_func.Value & permit.cbx_league.Value & permit.cbx_calibre.Value & permit.cbx_division.Value
cnt = Application.WorksheetFunction.CountIf(ws_ad.Columns(5), str_activity)
If cnt = 1 Then 'activity detail exists
ade = True
r9 = Application.WorksheetFunction.Match(str_activity, ws_ad.Columns(5), 0)
df_actdet_avail
Else 'no activity detail on file
ade = False
If rcode Like "D*" Then
df_actdet_navail_dia
ElseIf rcode Like "F*" Then
df_actdet_navail_fld
End If
End If
End If
'populate setup fields
With permit
ElseIf rcode = "GS" Then
.tb_f4_att.Value = df_attend
.tb_f4_att.Enabled = True
chk_main
With .cbx_f4_shut
.Value = df_shut
.List = Range("nm_shut")
.Enabled = True
chk_main
End With
With .cbx_f4_gen
.Value = df_gen
.List = Range("nm_gen")
.Enabled = True
chk_main
End With
With .cbx_f4_pas
.Value = df_pas
.List = Range("nm_pas")
.Enabled = True
chk_main
End With
With .cbx_f4_license
.Value = df_lcs
.List = Range("nm_lcs")
.Enabled = True
chk_main
End With
tb_f4_tables.Value = df_tblh
tb_f4_tables.Enabled = True
chk_main
With .cbx_f4_hydro
.Value = df_hyd
.List = Range("nm_hyd")
.Enabled = True
chk_main
End With
With .cbx_f4_water
.Value = df_wtr
.List = Range("nm_wtr")
.Enabled = True
chk_main
End With
With .cbx_f4_ph
.Value = df_ph
.List = Range("nm_ph")
.Enabled = True
chk_main
End With
.tb_f4_fence.Value = df_pf
chk_main
'tb_ft_other = df_o1
Else
MsgBox "Error: Populate"
End If
End With
End Sub
Is anyone able to help me correct this error? I apologize if this is the same problem, or similar to the one I posted here. I feel it's similar, but not quite sure how and I haven't quite figured out how it all relates.