Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DB DB is offline
external usenet poster
 
Posts: 46
Default Manually Update Listindex

I have a combobox on a user form that is populated when the form opens. The
listindex is not updated unless I "reselect" the same value from the dropdown
menu. How can I have the listindex automatically update when the combobox is
populated. This is on a pretty new version of Excel for Mac. I don't have
this problem with the older version of Excel for Mac.

Thanks for any help

DB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Manually Update Listindex


Hello DB,

What OS are you running? I tested setting the Listindex of ComboBox
using Excel with OS X . I placed the code in the User Form Initialize
Event module with no problems. I used ComboBox1.ListIndex = 3 to bring
up the 4th item in my list of 5 with no problems. Maybe you should post
your code.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=378251

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Manually Update Listindex

Can't you just set the listindex at the end of your population code.

Something like

Private Sub UserForm_Initialize()
Dim lCounter As Long
With cbInput
Application.EnableEvents = False
For lCounter = 1 To 10
.AddItem lCounter
Next lCounter
Application.EnableEvents = True
.ListIndex = 0
End With
End Sub

Robin Hammond
www.enhanceddatasystems.com

"DB" wrote in message
...
I have a combobox on a user form that is populated when the form opens.
The
listindex is not updated unless I "reselect" the same value from the
dropdown
menu. How can I have the listindex automatically update when the combobox
is
populated. This is on a pretty new version of Excel for Mac. I don't
have
this problem with the older version of Excel for Mac.

Thanks for any help

DB



  #4   Report Post  
Posted to microsoft.public.excel.programming
DB DB is offline
external usenet poster
 
Posts: 46
Default Manually Update Listindex



"Leith Ross" wrote:


Hello DB,

What OS are you running? I tested setting the Listindex of ComboBox
using Excel with OS X . I placed the code in the User Form Initialize
Event module with no problems. I used ComboBox1.ListIndex = 3 to bring
up the 4th item in my list of 5 with no problems. Maybe you should post
your code.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=378251


  #5   Report Post  
Posted to microsoft.public.excel.programming
DB DB is offline
external usenet poster
 
Posts: 46
Default Manually Update Listindex

Basically, the combobox2 list depends on the value of combobox1. If I select
a value from the combobox1 list, combobox2 works just fine. However, if the
value of combobox1 is set by code (see below) to a value that is the same as
one in the list for combobox1, the list index does not change accordingly. I
just had a thought: do you think I need to change the order of the two lines
of code in the Initialize sub?

Private Sub UserForm_Initialize()
ComboBox1.Value = Sheets("Sheet1").Cells(4, 3).Value
ComboBox1.List = Sheets("Sheet2").Range("B5:B10").Value
End Sub
Private Sub ComboBox2_Enter()
Dim ListRow As Long
ListRow = ComboBox1.ListIndex + 5
ComboBox2.AddItem (Sheets("Sheet2").Cells(ListRow, 3).Value)
End Sub

"Leith Ross" wrote:


Hello DB,

What OS are you running? I tested setting the Listindex of ComboBox
using Excel with OS X . I placed the code in the User Form Initialize
Event module with no problems. I used ComboBox1.ListIndex = 3 to bring
up the 4th item in my list of 5 with no problems. Maybe you should post
your code.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=378251


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
How to update one manually-entered value from another? 1robc57 Excel Worksheet Functions 2 February 2nd 06 05:07 AM
Manually update links Emma Excel Worksheet Functions 0 February 22nd 05 01:23 PM
combo box and .listindex dirt Excel Programming 3 September 10th 04 03:01 AM
listindex Steph[_3_] Excel Programming 1 June 25th 04 06:14 PM
ListIndex Todd Huttenstine Excel Programming 2 May 13th 04 04:21 PM


All times are GMT +1. The time now is 05:41 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"