Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Populating form dropdown at run time

I have a dropdown form field in my excel sheet. I want to set the
"Input Range" value at run time based on a selection of another
dropdown. So when a user selects a value in dropdown1, it will populate
the range for dropdown2.


With Sheet1.DropDowns("dropdown2")
.ListFillRange = Sheet1.Range("A1:A10")
End With

This code is not working...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Populating form dropdown at run time

Sub abc()
With Sheet1.DropDowns("drop down 2")
.ListFillRange = "Sheet1!A1:A10"
End With
End Sub
--
Regards,
Tom Ogilvy


"No_Spam" wrote:

I have a dropdown form field in my excel sheet. I want to set the
"Input Range" value at run time based on a selection of another
dropdown. So when a user selects a value in dropdown1, it will populate
the range for dropdown2.


With Sheet1.DropDowns("dropdown2")
.ListFillRange = Sheet1.Range("A1:A10")
End With

This code is not working...


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Populating form dropdown at run time

Excellent. Thank you!

How can I can get the dropdown name that was just changed? If a value
changes in a dropdown, I want to be able to call this generic sub, but
this sub needs to know which drod down called it.. Currently I'm using
the onchange event to pass the drop down name to the sub. Is there a
more generic way of doing it, since I have many drop downs and don't
want to have too many onchange events?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default Populating form dropdown at run time

I would guess it is expecting a range as a String, not a Range.
..ListFillRange = "A1:A10"

NickHK

"No_Spam"
egroups.com...
I have a dropdown form field in my excel sheet. I want to set the
"Input Range" value at run time based on a selection of another
dropdown. So when a user selects a value in dropdown1, it will populate
the range for dropdown2.


With Sheet1.DropDowns("dropdown2")
.ListFillRange = Sheet1.Range("A1:A10")
End With

This code is not working...



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Populating form dropdown at run time

You can use Application.caller to get the name.

Option Explicit
Sub testme()
Dim myDD As DropDown

Set myDD = ActiveSheet.DropDowns(Application.Caller)

With myDD
If .ListIndex -1 Then
MsgBox .Value & vbLf & .ListIndex & vbLf & .List(.ListIndex) _
& .TopLeftCell.Address(0, 0)
End If
End With

End Sub

You may be able to assign the same sub to all your dropdowns--then use something
else to determine which branch to take.

No_Spam wrote:

Excellent. Thank you!

How can I can get the dropdown name that was just changed? If a value
changes in a dropdown, I want to be able to call this generic sub, but
this sub needs to know which drod down called it.. Currently I'm using
the onchange event to pass the drop down name to the sub. Is there a
more generic way of doing it, since I have many drop downs and don't
want to have too many onchange events?


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Populating form dropdown at run time


Thanks! That saves lots of event writing!!!

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
dropdown lists and populating new table based on the selection Herbert Seidenberg Excel Discussion (Misc queries) 1 November 26th 08 05:54 AM
Formula not populating from dropdown box.Works when entered manua Grandmother of 2 Excel Worksheet Functions 2 January 1st 07 03:46 PM
populating DropDown with Values Of a Column in another Sheet. ZarrinPour Excel Discussion (Misc queries) 7 March 12th 06 02:51 PM
populating a dropdown based on choice from a previous dropdown Conor[_3_] Excel Programming 2 March 9th 06 07:15 PM
Populating a dropdown list with an Array MC[_3_] Excel Programming 3 March 4th 04 05:32 PM


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

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"