LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default combobox update

I have 2 modules with a combo box in each that I would like to have
update automatically. Module 1: company names, Module 2: Company 1 & 2
address. Right now if I select company 1, I get company 1 address. If
I select Company 2, I still have company 1 addresses. If I go into view
code and run the form, I get company 1 and company 2 addresses.

Here is a basic form of what I had, I shrunk them to save space. (There
is more companies and addresses than 2.)
Module 1
Public Sub Combobox1_DropButtonClick()
Dim arrCompany(1 To 2)
arrCompany(1) = "Company 1"
arrCompany(2) = "Company 2"
Dim Entrycount As Long
For Entrycount = 1 To 2
Worksheets("Template").ComboBox1.AddItem
arrCompany(Entrycount)
Next

End Sub

Module 2
Public Sub ComboBox2_DropButtonClick()

'Company 1
If Worksheets("Template").ComboBox1.Value = "Company 1" Then
Dim arrNTC(1 To 2)
arrNTC(1) = "Company 1 Address 1"
arrNTC(2) = "Company 1 Address 2"
Dim Entrycount1 As Long
For Entrycount1 = 1 To 2
Worksheets("Template").ComboBox2.AddItem
arrNTC(Entrycount1)
Next
End If

'Company 2
If Worksheets("Template").ComboBox1.Value = "Company 2" Then
Dim arrSTC(3 To 4)
arrSTC(3) = "Company 2 Address 1"
arrSTC(4) = "Company 2 Address 2"
Dim entrycount2 As Long
For entrycount2 = 3 To 4
Worksheets("Template").ComboBox2.AddItem
arrSTC(entrycount2)
Next
End If
End Sub

Any help would be greatly appreciated, I am still quite new to VB.

Josh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Need to update a ComboBox when selecting a sheet [email protected] Excel Worksheet Functions 1 October 31st 07 02:23 PM
Combobox update Robert Couchman[_4_] Excel Programming 0 February 20th 04 09:13 AM
Combobox: Selecting values from a row and place in combi box plus update New user Excel Programming 2 January 22nd 04 01:46 PM
Dynamic update on ComboBox Kevin Excel Programming 4 October 14th 03 12:45 PM


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