Dave: I don't recommend giving poorly documented microsoft internal tricks is
wise to people who barely know how to program VBA. What will they do when
they look at the code in a month and have no idea what the code really does?
> Try:
> ..RowSource = "PoolTypes"
[quoted text clipped - 20 lines]
> >
> > Thanks,
Dave Peterson - 16 Sep 2007 14:29 GMT
I don't understand.
Which one is poorly documented?
> Dave: I don't recommend giving poorly documented microsoft internal tricks is
> wise to people who barely know how to program VBA. What will they do when
[quoted text clipped - 28 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Hi,
Thanks to you both for your replies.
I have tried these:
With frmPoolTypes.lstPoolList
.RowSource =
Worksheets("Table").Range("PoolTypes").Address(external:=True)
and I tried
.RowSource = "PoolTypes"
and I tried
.RowSource = Sheets("Table").Range("PoolTypes")
End With
The form comes up but with no data. I get no error messages.
I have double checked the names of my form, listbox, sheet and range.
I can set the caption for the form ok, but I'm not getting the data range.
What else could I be missing?
Thanks
> Try:
> ..RowSource = "PoolTypes"
[quoted text clipped - 20 lines]
> >
> > Thanks,
Dave Peterson - 16 Sep 2007 19:04 GMT
The only thing I (don't) see is where you put this code.
Is it in the userform_initialization procedure?
All 3 of these worked ok for me:
Option Explicit
Private Sub UserForm_Initialize()
Me.lstPoolList.RowSource = "PoolTypes"
Me.lstPoolList.RowSource = "'Table'!PoolTypes"
Me.lstPoolList.RowSource = ThisWorkbook.Worksheets("table") _
.Range("Pooltypes").Address(external:=True)
End Sub
> Hi,
>
[quoted text clipped - 49 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Dave Peterson - 16 Sep 2007 19:05 GMT
Any chance that you renamed that _initialize procedure to something like:
frmPoolTypes_Initialize
????
If you did, name it back to what excel expects it to be.
UserForm_Initialize
> Hi,
>
[quoted text clipped - 49 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Karen53 - 16 Sep 2007 19:28 GMT
Hi Dave,
Here is my complete code for the form. This resides in the forms module.
I have the new value being obtained by a textbox when they click 'Save'.
Sub frmPoolTypes_Initialize()
Load frmPoolTypes
Me.Caption = "Pool Types"
With Me.lstPoolList
'.RowSource =
Worksheets("Table").Range("PoolTypes").Address(external:=True)
'.RowSource = "PoolTypes"
.RowSource = Sheets("Table").Range("PoolTypes")
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
frmPoolTypes.Show
End Sub
Private Sub cmdSave_Click()
Dim Choice As Long
Dim NewPool As String
Choice = lstPoolList.ListIndex
NewPool = txtNewPool
Range("PoolTypes").Item(Choice, 1).Value = NewPool
Unload frmPoolTypes
End Sub
Private Sub cmdCancel_Click()
Unload frmPoolTypes
End Sub
Do you see anything I've missed?
Thanks,
> Any chance that you renamed that _initialize procedure to something like:
> frmPoolTypes_Initialize
[quoted text clipped - 56 lines]
> > >
> > > Dave Peterson
Dave Peterson - 16 Sep 2007 19:48 GMT
Yep.
You didn't use the correct procedure name.
Sub Userform_Initialize()
Me.Caption = "Pool Types"
With Me.lstPoolList
.RowSource _
= Worksheets("Table").Range("PoolTypes").Address(external:=True)
'.RowSource = "PoolTypes"
'.RowSource = Sheets("Table").Range("PoolTypes")
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
End Sub
I didn't look at the other routines.
> Hi Dave,
>
[quoted text clipped - 110 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Karen53 - 16 Sep 2007 20:32 GMT
Thanks Dave. I've corrected that but I'm getting a type mismatch error
message but nothing is highlighting in yellow. I've double checked the anmes
of the userform, listbox, and named range in this procedure. I don't see
anything.
Sub Userform_Initialize()
Load frmPoolTypes
Me.Caption = "Pool Types"
With Me.lstPoolList
.RowSource = Sheets("Table").Range("PoolTypes")
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
frmPoolTypes.Show
End Sub
> Yep.
>
[quoted text clipped - 132 lines]
> > >
> > > Dave Peterson
Dave Peterson - 16 Sep 2007 20:49 GMT
Try the suggestion that I posted in the last response.
I removed the "load", "show" lines for a reason.
You also changed the .rowsource line from what I suggested.
> Thanks Dave. I've corrected that but I'm getting a type mismatch error
> message but nothing is highlighting in yellow. I've double checked the anmes
[quoted text clipped - 158 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Karen53 - 16 Sep 2007 20:50 GMT
I've isolated it to my rowsource statement. "Table" is the name of the sheet
and "PoolTypes" is my named range. I don't get it.
.RowSource = Sheets("Table").Range("PoolTypes")
> Yep.
>
[quoted text clipped - 132 lines]
> > >
> > > Dave Peterson
Karen53 - 16 Sep 2007 20:56 GMT
Ok, I took out the Sheets("Table") and left just the "PoolTypes" and it
works. What's wrong with my Sheets? That is the name of the sheet.
> Yep.
>
[quoted text clipped - 132 lines]
> > >
> > > Dave Peterson
Dave Peterson - 17 Sep 2007 00:39 GMT
Try the previous suggestion and don't modify that code.
> Ok, I took out the Sheets("Table") and left just the "PoolTypes" and it
> works. What's wrong with my Sheets? That is the name of the sheet.
[quoted text clipped - 139 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Karen53 - 17 Sep 2007 03:00 GMT
Hi Dave,
Thank you for your help. I FINALLY got it. Sorry to take so long and thank
you for your patience.
> Try the previous suggestion and don't modify that code.
>
[quoted text clipped - 141 lines]
> > >
> > > Dave Peterson