Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Populate Combobox

I have a combobox in a worksheet and on a userform, both containing the exact
same choices. As soon as a different choice is made in the combobox on my
worksheet, my userform opens. I am struggling with getting the new item
choice from my worksheet populated into the combobox on my userform.

If Sheets("Sheet1").Range("F434").Value = 1 Then
frmFields.txtActivityCmb.ListIndex = 0
End If

I've tried adding the code to UserFrom_Activate, which doesn't work. It does
work when added the code to a macro assigned to the combobox in the
worksheet. But, it doesn't work until the the combobox selection is made a
second time. I think that when the userform is opening, it's not catching
the update in the worksheet yet. Any ideas how I can change the code to
update the change in the worksheet before opening the userform. I don't want
to save the worksheet though; I'd like the user to be able to decide if they
want to save it. Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Populate Combobox

My apologies. My code works fine, I had it in the wrong place. Thank you.

"Alex" wrote:

I have a combobox in a worksheet and on a userform, both containing the exact
same choices. As soon as a different choice is made in the combobox on my
worksheet, my userform opens. I am struggling with getting the new item
choice from my worksheet populated into the combobox on my userform.

If Sheets("Sheet1").Range("F434").Value = 1 Then
frmFields.txtActivityCmb.ListIndex = 0
End If

I've tried adding the code to UserFrom_Activate, which doesn't work. It does
work when added the code to a macro assigned to the combobox in the
worksheet. But, it doesn't work until the the combobox selection is made a
second time. I think that when the userform is opening, it's not catching
the update in the worksheet yet. Any ideas how I can change the code to
update the change in the worksheet before opening the userform. I don't want
to save the worksheet though; I'd like the user to be able to decide if they
want to save it. Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Populate Combobox

Not sure what you are trying to do, but maybe this will help you get there.
Combo boxes do not exist until they are loaded and when they are unloaded
they no longer exist. You cannot assign a value to a combo box that does not
exist. So to do what it looks like you are trying to do, both combo boxes
must be loaded at the time you try to assign the value of one to the other.
HTH

"Alex" wrote:

I have a combobox in a worksheet and on a userform, both containing the exact
same choices. As soon as a different choice is made in the combobox on my
worksheet, my userform opens. I am struggling with getting the new item
choice from my worksheet populated into the combobox on my userform.

If Sheets("Sheet1").Range("F434").Value = 1 Then
frmFields.txtActivityCmb.ListIndex = 0
End If

I've tried adding the code to UserFrom_Activate, which doesn't work. It does
work when added the code to a macro assigned to the combobox in the
worksheet. But, it doesn't work until the the combobox selection is made a
second time. I think that when the userform is opening, it's not catching
the update in the worksheet yet. Any ideas how I can change the code to
update the change in the worksheet before opening the userform. I don't want
to save the worksheet though; I'd like the user to be able to decide if they
want to save it. Thanks for your help.

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
Populate a ComboBox Greg Maxey[_3_] Excel Programming 3 March 22nd 07 06:23 PM
use selected value from one combobox to populate another combobox rjudge[_7_] Excel Programming 3 April 14th 06 02:01 PM
Populate combobox Pat Excel Programming 1 December 10th 04 05:33 PM
Populate a combobox Rory[_3_] Excel Programming 2 June 9th 04 04:20 PM


All times are GMT +1. The time now is 10:18 AM.

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

About Us

"It's about Microsoft Excel"