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

ActiveWorkbook.Worksheets("model").Shapes("selecto r").DropDown =
Range("config!$list")
I would like to use in vba a command that could define dinamically the data
of a dropdown box, something like what is above (but that works!).
Anyone can help me?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default dropdown control



Option Explicit
Sub testme()

Dim myRng As Range

With Worksheets("Sheet1") '<-- where the data is
Set myRng = .Range("A1", .Cells(.Rows.Count, "A").End(xlUp))
End With

'If it's a dropdown from the Forms toolbar:
With Worksheets("Sheet2") '<-- where the controls are
.DropDowns("Drop down 1").ListFillRange = myRng.Address(external:=True)
End With


'If it's a combobox from the control toolbox toolbar
With Worksheets("sheet2")
.OLEObjects("combobox1").ListFillRange = myRng.Address(external:=True)
End With

End Sub

Walmir wrote:

ActiveWorkbook.Worksheets("model").Shapes("selecto r").DropDown =
Range("config!$list")
I would like to use in vba a command that could define dinamically the data
of a dropdown box, something like what is above (but that works!).
Anyone can help me?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default dropdown control

Dave,
in my case I used a dropdown from the Forms toolbar, but I didn't want it to
have blank rows. That was my problem that persisted.
Thank you very much for your help.
In fact I found another solution:

For j = 1 To numrows
Range("sheet2!A" & j) = "Estrat " & j
Next j
ActiveWorkbook.Names.Add "list", Range("sheet2!A1:A" & numrows)
ActiveWorkbook.Worksheets("sheet1").Shapes"dropdow n1").ControlFormat.ListFillRange = "list"

"Dave Peterson" wrote:



Option Explicit
Sub testme()

Dim myRng As Range

With Worksheets("Sheet1") '<-- where the data is
Set myRng = .Range("A1", .Cells(.Rows.Count, "A").End(xlUp))
End With

'If it's a dropdown from the Forms toolbar:
With Worksheets("Sheet2") '<-- where the controls are
.DropDowns("Drop down 1").ListFillRange = myRng.Address(external:=True)
End With


'If it's a combobox from the control toolbox toolbar
With Worksheets("sheet2")
.OLEObjects("combobox1").ListFillRange = myRng.Address(external:=True)
End With

End Sub

Walmir wrote:

ActiveWorkbook.Worksheets("model").Shapes("selecto r").DropDown =
Range("config!$list")
I would like to use in vba a command that could define dinamically the data
of a dropdown box, something like what is above (but that works!).
Anyone can help me?


--

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
Disable and enable dropdown combobox(Form Control) Vinod[_2_] Excel Discussion (Misc queries) 0 November 6th 07 07:30 PM
Disable dropdown list (Combo box -"Form control") Vinod[_2_] Excel Worksheet Functions 1 November 5th 07 06:01 PM
Loss of dropdown control when publishing Kelly Mayo Excel Worksheet Functions 0 September 22nd 06 03:22 PM
populating a dropdown based on choice from a previous dropdown Conor[_3_] Excel Programming 2 March 9th 06 07:15 PM
Dropdown control as multiline Bob Umlas[_3_] Excel Programming 0 August 15th 03 08:12 PM


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

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"