#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 516
Default Drop Down List

I am trying to construct a drop down list with a variable number of items to
select. I have data in a list (=$H$18:$H$24). Each field is turned on or
off based on exterior parameters. Currently, if my drop down list has half
the possible choices the rest are blank. How do I remove the blank spaces?
Can I do this in the validation screen or do I need to change the list I am
pulling my options from?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default Drop Down List

Try put this in ur sheet-tab-code-window
check in H18:H24 and make drop-list in H2

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t, List
For t = 18 To 24
If Cells(t, "H") < "" Then List = List & "," & Cells(t, "H")
Next
With Range("H2").Validation
.Delete
.Add xlValidateList, Formula1:=List
.InCellDropdown = True
End With
End Sub


"Matt" skrev:

I am trying to construct a drop down list with a variable number of items to
select. I have data in a list (=$H$18:$H$24). Each field is turned on or
off based on exterior parameters. Currently, if my drop down list has half
the possible choices the rest are blank. How do I remove the blank spaces?
Can I do this in the validation screen or do I need to change the list I am
pulling my options from?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 516
Default Drop Down List

I'm not familiar with using the Visual Basic editor. Please explain how to
insert the code into the worksheet.

"excelent" wrote:

Try put this in ur sheet-tab-code-window
check in H18:H24 and make drop-list in H2

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t, List
For t = 18 To 24
If Cells(t, "H") < "" Then List = List & "," & Cells(t, "H")
Next
With Range("H2").Validation
.Delete
.Add xlValidateList, Formula1:=List
.InCellDropdown = True
End With
End Sub


"Matt" skrev:

I am trying to construct a drop down list with a variable number of items to
select. I have data in a list (=$H$18:$H$24). Each field is turned on or
off based on exterior parameters. Currently, if my drop down list has half
the possible choices the rest are blank. How do I remove the blank spaces?
Can I do this in the validation screen or do I need to change the list I am
pulling my options from?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default Drop Down List

ok i dont no the UK-version but ill try anyway

Rightclick on sheet-tab
select "Show program code" - or som like that
paste code in that window

drop-down list will be in H2

"Matt" skrev:

I'm not familiar with using the Visual Basic editor. Please explain how to
insert the code into the worksheet.

"excelent" wrote:

Try put this in ur sheet-tab-code-window
check in H18:H24 and make drop-list in H2

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t, List
For t = 18 To 24
If Cells(t, "H") < "" Then List = List & "," & Cells(t, "H")
Next
With Range("H2").Validation
.Delete
.Add xlValidateList, Formula1:=List
.InCellDropdown = True
End With
End Sub


"Matt" skrev:

I am trying to construct a drop down list with a variable number of items to
select. I have data in a list (=$H$18:$H$24). Each field is turned on or
off based on exterior parameters. Currently, if my drop down list has half
the possible choices the rest are blank. How do I remove the blank spaces?
Can I do this in the validation screen or do I need to change the list I am
pulling my options from?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 516
Default Drop Down List

i am US version, so that worked. i changed the "" to "0" and it did the
trick. i have about 7 of these running on one page. can i just copy and
paste the same codes below the first (changing names and fields of course),
or do i need to make a new module? Thanks for your help.

Matt


"excelent" wrote:

ok i dont no the UK-version but ill try anyway

Rightclick on sheet-tab
select "Show program code" - or som like that
paste code in that window

drop-down list will be in H2

"Matt" skrev:

I'm not familiar with using the Visual Basic editor. Please explain how to
insert the code into the worksheet.

"excelent" wrote:

Try put this in ur sheet-tab-code-window
check in H18:H24 and make drop-list in H2

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t, List
For t = 18 To 24
If Cells(t, "H") < "" Then List = List & "," & Cells(t, "H")
Next
With Range("H2").Validation
.Delete
.Add xlValidateList, Formula1:=List
.InCellDropdown = True
End With
End Sub


"Matt" skrev:

I am trying to construct a drop down list with a variable number of items to
select. I have data in a list (=$H$18:$H$24). Each field is turned on or
off based on exterior parameters. Currently, if my drop down list has half
the possible choices the rest are blank. How do I remove the blank spaces?
Can I do this in the validation screen or do I need to change the list I am
pulling my options from?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 516
Default Drop Down List

one more question for you. when i change parameters and the choices change i
need to reset the default selection. how do i do that?

"excelent" wrote:

ok i dont no the UK-version but ill try anyway

Rightclick on sheet-tab
select "Show program code" - or som like that
paste code in that window

drop-down list will be in H2

"Matt" skrev:

I'm not familiar with using the Visual Basic editor. Please explain how to
insert the code into the worksheet.

"excelent" wrote:

Try put this in ur sheet-tab-code-window
check in H18:H24 and make drop-list in H2

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t, List
For t = 18 To 24
If Cells(t, "H") < "" Then List = List & "," & Cells(t, "H")
Next
With Range("H2").Validation
.Delete
.Add xlValidateList, Formula1:=List
.InCellDropdown = True
End With
End Sub


"Matt" skrev:

I am trying to construct a drop down list with a variable number of items to
select. I have data in a list (=$H$18:$H$24). Each field is turned on or
off based on exterior parameters. Currently, if my drop down list has half
the possible choices the rest are blank. How do I remove the blank spaces?
Can I do this in the validation screen or do I need to change the list I am
pulling my options from?

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
Using a drop-down list along with an auto-populate drop-down CrazyLostConfused Excel Discussion (Misc queries) 1 April 17th 07 12:10 AM
Drop Down List choice selecting another drop down list CVD0722 Excel Worksheet Functions 3 October 31st 06 01:02 PM
how do I link a drop down list entry to a new drop down cell? lmunzen Excel Discussion (Misc queries) 1 August 15th 06 04:59 PM
Can I create a drop-down list that will reference other drop-down fdebelo Excel Worksheet Functions 3 January 7th 06 09:34 AM
multiple select from the drop down list in excel. list in one sheet and drop down in sriramus Excel Discussion (Misc queries) 5 October 27th 05 06:55 PM


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