Hi All
My UserForm is initialised from lists on a worksheet named “Data Lists” using this code:
Public Sub UserForm_Initialize()
With cboSerialNo
.RowSource = shDataList.[Serial_No].Address
.ListIndex = 0
End With
With cboTailNo
.RowSource = shDataList.[HarTail].Address
.ListIndex = 0
End With
With cboUnit
.RowSource = shDataList.[Units].Address
.ListIndex = 0
End With
With cboDateON
.RowSource = shDataList.[Date].Address
.ListIndex = 1
End With
With cboDateOFF
.RowSource = shDataList.[Date].Address
.ListIndex = 1
End With
End Sub
The shDataList part of the RowSource property is the Worksheet Reference Name, created as per Bowers74’s FAQ707-4090, as are the references to Named ranges in square brackets, e.g. “[Date]”.
I have another sheet in the Wb called “Current”. Both this sheet and “Data Lists” have a button which shows the form.
My problem is this: if I call the form with “Data Lists” showing, all the boxes initialise correctly, values are filled in where appropriate, and calculated fields all work.![[bigsmile] [bigsmile] [bigsmile]](/data/assets/smilies/bigsmile.gif)
If I call the form from “Current”, the boxes are blank, no values appear, and I get the error “Type Mismatch” from one of the Change() event lines.![[sad] [sad] [sad]](/data/assets/smilies/sad.gif)
Is this because the Named Ranges [Date], [Units], [Serial_No] etc are Worksheet-Level names? If so, how can I either (a) Workaround it, or (b) make them Workbook-level names?
Hope you can bail me out (yet again!)![[wink] [wink] [wink]](/data/assets/smilies/wink.gif)
Chris
My UserForm is initialised from lists on a worksheet named “Data Lists” using this code:
Public Sub UserForm_Initialize()
With cboSerialNo
.RowSource = shDataList.[Serial_No].Address
.ListIndex = 0
End With
With cboTailNo
.RowSource = shDataList.[HarTail].Address
.ListIndex = 0
End With
With cboUnit
.RowSource = shDataList.[Units].Address
.ListIndex = 0
End With
With cboDateON
.RowSource = shDataList.[Date].Address
.ListIndex = 1
End With
With cboDateOFF
.RowSource = shDataList.[Date].Address
.ListIndex = 1
End With
End Sub
The shDataList part of the RowSource property is the Worksheet Reference Name, created as per Bowers74’s FAQ707-4090, as are the references to Named ranges in square brackets, e.g. “[Date]”.
I have another sheet in the Wb called “Current”. Both this sheet and “Data Lists” have a button which shows the form.
My problem is this: if I call the form with “Data Lists” showing, all the boxes initialise correctly, values are filled in where appropriate, and calculated fields all work.
![[bigsmile] [bigsmile] [bigsmile]](/data/assets/smilies/bigsmile.gif)
If I call the form from “Current”, the boxes are blank, no values appear, and I get the error “Type Mismatch” from one of the Change() event lines.
![[sad] [sad] [sad]](/data/assets/smilies/sad.gif)
Is this because the Named Ranges [Date], [Units], [Serial_No] etc are Worksheet-Level names? If so, how can I either (a) Workaround it, or (b) make them Workbook-level names?
Hope you can bail me out (yet again!)
![[wink] [wink] [wink]](/data/assets/smilies/wink.gif)
Chris