Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Userform Not working PLEASE HELP

I have created a dialog box (NotSoFast) to pop up when my workbook is opened.
The dialog box has 4 comboboxes (Name, Center, Month, Week) each of which
I've created data for, and a button (Panic Switch) which captures the data.
My dialog box shows when the workbook is opened but there's no data in any of
my combobox lists. What is causing this? Below is my code:

Auto_open code
Private Sub Workbook_Open()
NotSoFast.Show
End Sub
---------------------------------------------------------
command button code
Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
Unload NotSoFast
End Sub
---------------------------------------------------------
module code for the comboboxes
Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
With NotSoFast.Name
.RowSource = ""
.AddItem "Bishop Minter"
.AddItem "Carlos Trespalacios"
.AddItem "Dennis Murphy"
.AddItem "Gary Hayden"
.AddItem "Gloria Montoya"
.AddItem "Lisa Muttillo"
.AddItem "Lorraine Warburton"
.AddItem "Warner Langlois"
End With
With NotSoFast.Center
.RowSource = ""
.AddItem "Bothell"
.AddItem "Collinsville"
.AddItem "El Paso"
.AddItem "Evansville"
.AddItem "Greensboro"
.AddItem "Heathrow"
.AddItem "Joplin"
.AddItem "Kennesaw"
.AddItem "Lafayette"
.AddItem "Manhattan"
.AddItem "Mansfield"
.AddItem "Sioux City"
.AddItem "Ottawa"
.AddItem "Ponco City"
.AddItem "Terra Haute"
End With
With NotSoFast.Month
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
With NotSoFast.Week
.RowSource = ""
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
NotSoFast.Show
End Sub
---------------------------------------------------------
Also, the code will not compile unless I comment out anything pertaining to
Name. I get a "Compile Error: With object must be user-defined type, Object
or Variant" with the first With statement under Sub ShowNotSoFast(). If I
comment out that entire With Block I get a "Compile Error: Invalid Qualifier"
for Name in the NameSelect = Name.Value line under Private Sub
PanicSwitch_Click(). If I comment out both of those the code compiles. I've
retyped Name in Properties for the combobox and that didn't fix it. What's
the problem?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default UPDATE: Userform Not working PLEASE HELP

I changed "Name" to "NameC" and that corrected both of my compile errors so
disregard that part (I assume "Name" is a keyword?). Still can't get the
drop-downs to populate though.

"Bishop" wrote:

I have created a dialog box (NotSoFast) to pop up when my workbook is opened.
The dialog box has 4 comboboxes (Name, Center, Month, Week) each of which
I've created data for, and a button (Panic Switch) which captures the data.
My dialog box shows when the workbook is opened but there's no data in any of
my combobox lists. What is causing this? Below is my code:

Auto_open code
Private Sub Workbook_Open()
NotSoFast.Show
End Sub
---------------------------------------------------------
command button code
Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
Unload NotSoFast
End Sub
---------------------------------------------------------
module code for the comboboxes
Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
With NotSoFast.Name
.RowSource = ""
.AddItem "Bishop Minter"
.AddItem "Carlos Trespalacios"
.AddItem "Dennis Murphy"
.AddItem "Gary Hayden"
.AddItem "Gloria Montoya"
.AddItem "Lisa Muttillo"
.AddItem "Lorraine Warburton"
.AddItem "Warner Langlois"
End With
With NotSoFast.Center
.RowSource = ""
.AddItem "Bothell"
.AddItem "Collinsville"
.AddItem "El Paso"
.AddItem "Evansville"
.AddItem "Greensboro"
.AddItem "Heathrow"
.AddItem "Joplin"
.AddItem "Kennesaw"
.AddItem "Lafayette"
.AddItem "Manhattan"
.AddItem "Mansfield"
.AddItem "Sioux City"
.AddItem "Ottawa"
.AddItem "Ponco City"
.AddItem "Terra Haute"
End With
With NotSoFast.Month
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
With NotSoFast.Week
.RowSource = ""
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
NotSoFast.Show
End Sub
---------------------------------------------------------
Also, the code will not compile unless I comment out anything pertaining to
Name. I get a "Compile Error: With object must be user-defined type, Object
or Variant" with the first With statement under Sub ShowNotSoFast(). If I
comment out that entire With Block I get a "Compile Error: Invalid Qualifier"
for Name in the NameSelect = Name.Value line under Private Sub
PanicSwitch_Click(). If I comment out both of those the code compiles. I've
retyped Name in Properties for the combobox and that didn't fix it. What's
the problem?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Userform Not working PLEASE HELP

This line would be included in a procedure somewhere in Module1 or if you
have more than one public code module then whichever you are using. You can
also as a Sub title line and an End Sub line and use it as a stand alone
procedure.

NotSoFast.Show


This code (yours slightly modified) goes behind your UserForm dialog box.
Right click on the form or double click it in design mode and copy this into
the form code module. When you run the Show command from the public module,
it will activate the initialize event and it should load your comboboxes.

Private Sub NotSoFast_Initialize()
With Me.Name
.RowSource = ""
.AddItem "Bishop Minter"
.AddItem "Carlos Trespalacios"
.AddItem "Dennis Murphy"
.AddItem "Gary Hayden"
.AddItem "Gloria Montoya"
.AddItem "Lisa Muttillo"
.AddItem "Lorraine Warburton"
.AddItem "Warner Langlois"
End With
With Me.Center
.RowSource = ""
.AddItem "Bothell"
.AddItem "Collinsville"
.AddItem "El Paso"
.AddItem "Evansville"
.AddItem "Greensboro"
.AddItem "Heathrow"
.AddItem "Joplin"
.AddItem "Kennesaw"
.AddItem "Lafayette"
.AddItem "Manhattan"
.AddItem "Mansfield"
.AddItem "Sioux City"
.AddItem "Ottawa"
.AddItem "Ponco City"
.AddItem "Terra Haute"
End With
With Me.Month
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
With Me.Week
.RowSource = ""
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
End Sub





"Bishop" wrote in message
...
I have created a dialog box (NotSoFast) to pop up when my workbook is
opened.
The dialog box has 4 comboboxes (Name, Center, Month, Week) each of which
I've created data for, and a button (Panic Switch) which captures the
data.
My dialog box shows when the workbook is opened but there's no data in any
of
my combobox lists. What is causing this? Below is my code:

Auto_open code
Private Sub Workbook_Open()
NotSoFast.Show
End Sub
---------------------------------------------------------
command button code
Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
Unload NotSoFast
End Sub
---------------------------------------------------------
module code for the comboboxes
Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
With NotSoFast.Name
.RowSource = ""
.AddItem "Bishop Minter"
.AddItem "Carlos Trespalacios"
.AddItem "Dennis Murphy"
.AddItem "Gary Hayden"
.AddItem "Gloria Montoya"
.AddItem "Lisa Muttillo"
.AddItem "Lorraine Warburton"
.AddItem "Warner Langlois"
End With
With NotSoFast.Center
.RowSource = ""
.AddItem "Bothell"
.AddItem "Collinsville"
.AddItem "El Paso"
.AddItem "Evansville"
.AddItem "Greensboro"
.AddItem "Heathrow"
.AddItem "Joplin"
.AddItem "Kennesaw"
.AddItem "Lafayette"
.AddItem "Manhattan"
.AddItem "Mansfield"
.AddItem "Sioux City"
.AddItem "Ottawa"
.AddItem "Ponco City"
.AddItem "Terra Haute"
End With
With NotSoFast.Month
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
With NotSoFast.Week
.RowSource = ""
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
NotSoFast.Show
End Sub
---------------------------------------------------------
Also, the code will not compile unless I comment out anything pertaining
to
Name. I get a "Compile Error: With object must be user-defined type,
Object
or Variant" with the first With statement under Sub ShowNotSoFast(). If I
comment out that entire With Block I get a "Compile Error: Invalid
Qualifier"
for Name in the NameSelect = Name.Value line under Private Sub
PanicSwitch_Click(). If I comment out both of those the code compiles.
I've
retyped Name in Properties for the combobox and that didn't fix it.
What's
the problem?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Userform Not working PLEASE HELP

Didn't work. I copy/pasted your code just as you instructed. Everything is
working EXCEPT my comboboxes have no drop downs. I set the Matchrequired
field to True and the only thing that doesn't return an error is leaving the
field blank which is making me think the initialization process isn't taking
place at all. The Command Button works perfectly. Whatever info I put in
the boxes populates the correct cells but since my comboboxes aren't
initialized with the data I want you can put whatever you like in the
combobox field and it will take it. Why aren't my comboboxes populating?! I
also tried the method described he
http://www.contextures.com/xlUserForm02.html
and that still doesn't work! Here is my code:

behind the userform (NotSoFast)
Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = AName.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
Unload NotSoFast
End Sub
____________________________________

Private Sub NotSoFast_Initialize()
Dim cAName As Range
Dim cCenter As Range
Dim cMonth As Range
Dim cWeek As Range
Dim ws As Worksheet
Set ws = Worksheets("X")

For Each cAName In ws.Range("AName")
With NotSoFast.AName
.AddItem cAName.Value
.List(.ListCount - 1, 1) = cAName.Offset(0, 1).Value
End With
Next cAName

For Each cCenter In ws.Range("Center")
With Me.Center
.AddItem cCenter.Value
.List(.ListCount - 1, 1) = cCenter.Offset(0, 1).Value
End With
Next cCenter

For Each cMonth In ws.Range("Month")
With Me.Month
.AddItem cMonth.Value
.List(.ListCount - 1, 1) = cMonth.Offset(0, 1).Value
End With
Next cMonth

For Each cWeek In ws.Range("Week")
With Me.Week
.AddItem cWeek.Value
.List(.ListCount - 1, 1) = cWeek.Offset(0, 1).Value
End With
Next cWeek

End Sub

I have created the appropriate lists on sheet X as per the instructions.
Surely, it must be something simple that I'm missing... help.

"JLGWhiz" wrote:

This line would be included in a procedure somewhere in Module1 or if you
have more than one public code module then whichever you are using. You can
also as a Sub title line and an End Sub line and use it as a stand alone
procedure.

NotSoFast.Show


This code (yours slightly modified) goes behind your UserForm dialog box.
Right click on the form or double click it in design mode and copy this into
the form code module. When you run the Show command from the public module,
it will activate the initialize event and it should load your comboboxes.

Private Sub NotSoFast_Initialize()
With Me.Name
.RowSource = ""
.AddItem "Bishop Minter"
.AddItem "Carlos Trespalacios"
.AddItem "Dennis Murphy"
.AddItem "Gary Hayden"
.AddItem "Gloria Montoya"
.AddItem "Lisa Muttillo"
.AddItem "Lorraine Warburton"
.AddItem "Warner Langlois"
End With
With Me.Center
.RowSource = ""
.AddItem "Bothell"
.AddItem "Collinsville"
.AddItem "El Paso"
.AddItem "Evansville"
.AddItem "Greensboro"
.AddItem "Heathrow"
.AddItem "Joplin"
.AddItem "Kennesaw"
.AddItem "Lafayette"
.AddItem "Manhattan"
.AddItem "Mansfield"
.AddItem "Sioux City"
.AddItem "Ottawa"
.AddItem "Ponco City"
.AddItem "Terra Haute"
End With
With Me.Month
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
With Me.Week
.RowSource = ""
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
End Sub





"Bishop" wrote in message
...
I have created a dialog box (NotSoFast) to pop up when my workbook is
opened.
The dialog box has 4 comboboxes (Name, Center, Month, Week) each of which
I've created data for, and a button (Panic Switch) which captures the
data.
My dialog box shows when the workbook is opened but there's no data in any
of
my combobox lists. What is causing this? Below is my code:

Auto_open code
Private Sub Workbook_Open()
NotSoFast.Show
End Sub
---------------------------------------------------------
command button code
Private Sub PanicSwitch_Click()
MonthSelect = Month.Value
WeekSelect = Week.Value
NameSelect = Name.Value
CenterSelect = Center.Value
Cells(1, 1) = MonthSelect
Cells(2, 1) = WeekSelect
Cells(1, 2) = NameSelect
Cells(2, 2) = CenterSelect
Unload NotSoFast
End Sub
---------------------------------------------------------
module code for the comboboxes
Public NameSelect As String
Public CenterSelect As String
Public MonthSelect As String
Public WeekSelect As String

Sub ShowNotSoFast()
With NotSoFast.Name
.RowSource = ""
.AddItem "Bishop Minter"
.AddItem "Carlos Trespalacios"
.AddItem "Dennis Murphy"
.AddItem "Gary Hayden"
.AddItem "Gloria Montoya"
.AddItem "Lisa Muttillo"
.AddItem "Lorraine Warburton"
.AddItem "Warner Langlois"
End With
With NotSoFast.Center
.RowSource = ""
.AddItem "Bothell"
.AddItem "Collinsville"
.AddItem "El Paso"
.AddItem "Evansville"
.AddItem "Greensboro"
.AddItem "Heathrow"
.AddItem "Joplin"
.AddItem "Kennesaw"
.AddItem "Lafayette"
.AddItem "Manhattan"
.AddItem "Mansfield"
.AddItem "Sioux City"
.AddItem "Ottawa"
.AddItem "Ponco City"
.AddItem "Terra Haute"
End With
With NotSoFast.Month
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
With NotSoFast.Week
.RowSource = ""
.AddItem "Week 1"
.AddItem "Week 2"
.AddItem "Week 3"
.AddItem "Week 4"
.AddItem "Week 5"
End With
NotSoFast.Show
End Sub
---------------------------------------------------------
Also, the code will not compile unless I comment out anything pertaining
to
Name. I get a "Compile Error: With object must be user-defined type,
Object
or Variant" with the first With statement under Sub ShowNotSoFast(). If I
comment out that entire With Block I get a "Compile Error: Invalid
Qualifier"
for Name in the NameSelect = Name.Value line under Private Sub
PanicSwitch_Click(). If I comment out both of those the code compiles.
I've
retyped Name in Properties for the combobox and that didn't fix it.
What's
the problem?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Initializing Userform not working WLMPilot Excel Programming 4 January 9th 08 04:59 PM
userform not working nrk2104 Excel Programming 1 October 17th 07 12:49 PM
Unloading UserForm not working Marston Excel Programming 2 August 17th 04 04:18 AM
Userform in excel97 not working right! Simon Lloyd[_485_] Excel Programming 3 June 15th 04 03:53 PM
Userform not working jrh Excel Programming 1 March 4th 04 09:51 AM


All times are GMT +1. The time now is 04:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"