Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default combo box beginner question...

I've tried to find how to make choices in a combo box but had no luck. This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combo box beginner question...

Private Sub Userform_Initialize()
With Me.Internet
AddItem "A"
AddItem "B"
End With
End Sub

If internet is the name of the combobox, it isn't going to change unless you
type something in it or you make a selection - I doubt that is what you
want, so put your code in the Initialize event of the Userform. This should
be in the userform module( select the events from the dropdowns at the top
of the module to make sure they are declared correctly).

--
Regards,
Tom Ogilvy


"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no luck.

This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom



  #3   Report Post  
Posted to microsoft.public.excel.programming
moi moi is offline
external usenet poster
 
Posts: 27
Default combo box beginner question...

AddItem is correct, but not in the Change-event.
It seems to me you start with an empty combo, so it's value can never be
changed if it's empty.
In Visual Basic Editor, double click on ThisWorbook in your Project Explorer
on the left.
Then, copycat the following piece of code:

Private Sub Workbook_Open()
Sheets(1).ComboBox1.AddItem "A"
Sheets(1).ComboBox1.AddItem "B"
End Sub



"thomas" schreef in bericht
...
I've tried to find how to make choices in a combo box but had no luck.
This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default combo box beginner question...

That's a big help for me. I notice you answer a lot of people's questions, do
you work for Microsoft...No need to answer if to busy.
Thanks for the help

"Tom Ogilvy" wrote:

Private Sub Userform_Initialize()
With Me.Internet
AddItem "A"
AddItem "B"
End With
End Sub

If internet is the name of the combobox, it isn't going to change unless you
type something in it or you make a selection - I doubt that is what you
want, so put your code in the Initialize event of the Userform. This should
be in the userform module( select the events from the dropdowns at the top
of the module to make sure they are declared correctly).

--
Regards,
Tom Ogilvy


"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no luck.

This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default combo box beginner question...

Hi Thomas,

In additiion to Tom's suggestion.

Change the lines:

AddItem "A"
AddItem "B"

to:
. AddItem "A"
.AddItem "B"


(Prepend with .)

---
Regards,
Norman



"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no luck.
This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combo box beginner question...

You will see very few answers from Microsoft Employees. These are primarily
peer to peer support. Those MS employees that do answer indicate they are
employees with something like

Buddy Rich [MSFT]

or
Buddy Rich [MS]

or something similar.

So, no I am not a microsoft employee.

--
Regards,
Tom Ogilvy

"thomas" wrote in message
...
That's a big help for me. I notice you answer a lot of people's questions,

do
you work for Microsoft...No need to answer if to busy.
Thanks for the help

"Tom Ogilvy" wrote:

Private Sub Userform_Initialize()
With Me.Internet
AddItem "A"
AddItem "B"
End With
End Sub

If internet is the name of the combobox, it isn't going to change unless

you
type something in it or you make a selection - I doubt that is what you
want, so put your code in the Initialize event of the Userform. This

should
be in the userform module( select the events from the dropdowns at the

top
of the module to make sure they are declared correctly).

--
Regards,
Tom Ogilvy


"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no luck.

This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combo box beginner question...

Good catch. Thanks.

--
Regards,
Tom Ogilvy



"Norman Jones" wrote in message
...
Hi Thomas,

In additiion to Tom's suggestion.

Change the lines:

AddItem "A"
AddItem "B"

to:
. AddItem "A"
.AddItem "B"


(Prepend with .)

---
Regards,
Norman



"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no luck.
This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combo box beginner question...

for completeness - as Norman Jones pointed out, the AddItems need to be
..AddItems with a period to show they are qualified by Me.Internet

Private Sub Userform_Initialize()
With Me.Internet
.AddItem "A"
.AddItem "B"
End With
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
You will see very few answers from Microsoft Employees. These are

primarily
peer to peer support. Those MS employees that do answer indicate they

are
employees with something like

Buddy Rich [MSFT]

or
Buddy Rich [MS]

or something similar.

So, no I am not a microsoft employee.

--
Regards,
Tom Ogilvy

"thomas" wrote in message
...
That's a big help for me. I notice you answer a lot of people's

questions,
do
you work for Microsoft...No need to answer if to busy.
Thanks for the help

"Tom Ogilvy" wrote:

Private Sub Userform_Initialize()
With Me.Internet
AddItem "A"
AddItem "B"
End With
End Sub

If internet is the name of the combobox, it isn't going to change

unless
you
type something in it or you make a selection - I doubt that is what

you
want, so put your code in the Initialize event of the Userform. This

should
be in the userform module( select the events from the dropdowns at the

top
of the module to make sure they are declared correctly).

--
Regards,
Tom Ogilvy


"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no

luck.
This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom







  #9   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default combo box beginner question...

I can't seem to get this code to operate. The code is in UserForm1 as shown
below:
Sub UserForm_Initialize()
Load UserForm1
Call Init
Label1.Caption = "Enter System Type:"
CBox1.Value = Null
For i = 1 To 3
CBox1.AddItem SystemType(i).Name
Next i
End Sub

I assumed, to be on safe side, to clear the content of my combobox (CBox1).
The data I want to use to fill the combo box is in a previously loaded array
(SystemType(x).Name, but it obviously doesn't work. Any ideas?

Bob

"Tom Ogilvy" wrote:

for completeness - as Norman Jones pointed out, the AddItems need to be
..AddItems with a period to show they are qualified by Me.Internet

Private Sub Userform_Initialize()
With Me.Internet
.AddItem "A"
.AddItem "B"
End With
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
You will see very few answers from Microsoft Employees. These are

primarily
peer to peer support. Those MS employees that do answer indicate they

are
employees with something like

Buddy Rich [MSFT]

or
Buddy Rich [MS]

or something similar.

So, no I am not a microsoft employee.

--
Regards,
Tom Ogilvy

"thomas" wrote in message
...
That's a big help for me. I notice you answer a lot of people's

questions,
do
you work for Microsoft...No need to answer if to busy.
Thanks for the help

"Tom Ogilvy" wrote:

Private Sub Userform_Initialize()
With Me.Internet
AddItem "A"
AddItem "B"
End With
End Sub

If internet is the name of the combobox, it isn't going to change

unless
you
type something in it or you make a selection - I doubt that is what

you
want, so put your code in the Initialize event of the Userform. This

should
be in the userform module( select the events from the dropdowns at the

top
of the module to make sure they are declared correctly).

--
Regards,
Tom Ogilvy


"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no

luck.
This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom








  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default combo box beginner question...

Check your other thread.

Bob wrote:

I can't seem to get this code to operate. The code is in UserForm1 as shown
below:
Sub UserForm_Initialize()
Load UserForm1
Call Init
Label1.Caption = "Enter System Type:"
CBox1.Value = Null
For i = 1 To 3
CBox1.AddItem SystemType(i).Name
Next i
End Sub

I assumed, to be on safe side, to clear the content of my combobox (CBox1).
The data I want to use to fill the combo box is in a previously loaded array
(SystemType(x).Name, but it obviously doesn't work. Any ideas?

Bob

"Tom Ogilvy" wrote:

for completeness - as Norman Jones pointed out, the AddItems need to be
..AddItems with a period to show they are qualified by Me.Internet

Private Sub Userform_Initialize()
With Me.Internet
.AddItem "A"
.AddItem "B"
End With
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
You will see very few answers from Microsoft Employees. These are

primarily
peer to peer support. Those MS employees that do answer indicate they

are
employees with something like

Buddy Rich [MSFT]

or
Buddy Rich [MS]

or something similar.

So, no I am not a microsoft employee.

--
Regards,
Tom Ogilvy

"thomas" wrote in message
...
That's a big help for me. I notice you answer a lot of people's

questions,
do
you work for Microsoft...No need to answer if to busy.
Thanks for the help

"Tom Ogilvy" wrote:

Private Sub Userform_Initialize()
With Me.Internet
AddItem "A"
AddItem "B"
End With
End Sub

If internet is the name of the combobox, it isn't going to change

unless
you
type something in it or you make a selection - I doubt that is what

you
want, so put your code in the Initialize event of the Userform. This
should
be in the userform module( select the events from the dropdowns at the
top
of the module to make sure they are declared correctly).

--
Regards,
Tom Ogilvy


"thomas" wrote in message
...
I've tried to find how to make choices in a combo box but had no

luck.
This
is the code I wrote, but it doesn't show up in the combo box:


Private Sub Internet_Change()
With Internet
AddItem "A"
AddItem "B"
End With
End Sub


Why doesn't this show up when form is ran???
Thanks ahead of time,
Tom









--

Dave Peterson
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
Beginner Question Bernie Charts and Charting in Excel 0 February 13th 07 04:31 PM
Beginner question! Pat Excel Discussion (Misc queries) 3 August 7th 06 09:19 AM
Beginner question Tom. Excel Discussion (Misc queries) 1 April 24th 06 06:08 AM
Beginner VBA question light Excel Programming 0 November 10th 04 05:40 PM
Beginner VBA question light Excel Programming 1 November 10th 04 01:44 PM


All times are GMT +1. The time now is 05:29 PM.

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"