Quantcast
Channel: [OTP] VBA Using combobox in Excel
Viewing all articles
Browse latest Browse all 14

[OTP] VBA Using combobox in Excel

$
0
0

Yes if it is ok do sent me the worksheet... Can you not see my email when you click on my username? It's my username follow by hotmail.com

Btw i've kinda solved the problem by refering the comboboxes as shapes instead of combobox (see below)

But still i've one small problem before perfecting this: is it possible to have the "city" combobox to show the revised list whenever "country" combobox is changed? Currently the "city" combobox is empty (unless user clicks it) whenever the "country" combobox is changed.

Thanks for the help thus far.

 

Sub ComboBox1_Change()

Dim off As Integer
Dim thisCell As String
Dim thisRow As Integer
Dim blah As Shape
Dim blah2 As Shape


Set blah = Worksheets("main").Shapes(2)       ' countries combobox
Set blah2 = Worksheets("main").Shapes(3)     ' cities combobox

Application.ScreenUpdating = False                            
Worksheets("countries").Select                                       
thisRow = blah.ControlFormat.ListIndex                     
Worksheets("countries").Cells(thisRow + 1, 2).Select        
blah2.ControlFormat.RemoveAllItems
off = 0                                                                                  
thisCell = ActiveCell.Offset(0, off).Value                        
Do While thisCell <> ""                                                 
  blah2.ControlFormat.AddItem (thisCell)        
  off = off + 1                                                                         
  thisCell = Selection.Offset(0, off).Value                             
Loop                                                                                   
Worksheets("Main").Select                                          
End Sub


 


Viewing all articles
Browse latest Browse all 14

Latest Images

Trending Articles





Latest Images