View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
natanz[_2_] natanz[_2_] is offline
external usenet poster
 
Posts: 40
Default picking a userform to show

I have a userform with listbox which reads in a list from an excel
spreadsheet. When the user selects an item from the list I want to be
able to open a second userform, which will vary based on the first
selection. In my spreadsheet, the column adjacent to the list that
shows in the initial listbox, has the name of the userform i want to
bring up. I am able to find this name, because my MsgBox shows it, but
how can i get VBA to recognize that string as a userform name.

Private Sub LotList_Click()
Dim UnitType As String
Dim LotIndex As Integer
LotIndex = LotList.ListIndex
Range("lotnumbers").Offset(LotIndex, 1).Select
UnitType = CStr(ActiveCell.Value)
UnitType.show 'this is the line that is not
working
MsgBox UnitType

I am pretty new at this, and maybe trying something a little over my
head. I hope someone can help me. I appreciate any advice you have to
offer.