Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Action from list selection

All:

I have a number of options in a drop down list and based on the selection
(2, 3, 4 etc) need to unhide rows. So if user selects 4, need to unhide 4
rows, if they select 0, no rows should show. What's the best way to do this?
Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Action from list selection

I assume you have a number of rows hidden? after all in a sheet you can't
show no rows can you?

something like

Private Sub ComboBox1_Change()
Range("A10:A20").EntireRow.Hidden = True
Range("A10").Resize(ComboBox1.Value).EntireRow.Hid den = False
End Sub

this uses the activex combobox, so the code should be on the sheet's code
page - to get there, right click the sheet tab & select View Code

"Maze" wrote:

All:

I have a number of options in a drop down list and based on the selection
(2, 3, 4 etc) need to unhide rows. So if user selects 4, need to unhide 4
rows, if they select 0, no rows should show. What's the best way to do this?
Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Action from list selection

Patrick - thanks for replying. Maybe I wasn't clear enough with my question
but I was able to figure some code out that would work, the only problem is
it only works one directional. (Example: if user selects 4, then 5, it
works. If they select 2 it won't go back). Any thoughts? See code below.

Sub DropDown44_Change()
'IBDA selection

If range("v1").Value = "2" Then
Rows("16:19").Hidden = False
ElseIf range("v1").Value = "3" Then
Rows("16:23").Hidden = False
ElseIf range("v1").Value = "4" Then
Rows("16:27").Hidden = False
ElseIf range("v1").Value = "5" Then
Rows("16:31").Hidden = False
ElseIf range("v1").Value = "6" Then
Rows("16:35").Hidden = False

Else
Rows("16:60").Hidden = True

End If
End Sub


"Patrick Molloy" wrote:

I assume you have a number of rows hidden? after all in a sheet you can't
show no rows can you?

something like

Private Sub ComboBox1_Change()
Range("A10:A20").EntireRow.Hidden = True
Range("A10").Resize(ComboBox1.Value).EntireRow.Hid den = False
End Sub

this uses the activex combobox, so the code should be on the sheet's code
page - to get there, right click the sheet tab & select View Code

"Maze" wrote:

All:

I have a number of options in a drop down list and based on the selection
(2, 3, 4 etc) need to unhide rows. So if user selects 4, need to unhide 4
rows, if they select 0, no rows should show. What's the best way to do this?
Thank you.

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
Take Action on Cells within Selection Mike G - D.C. Excel Programming 3 June 29th 09 10:00 PM
action upon selection BorisS Excel Programming 1 August 30th 07 11:30 AM
Action on sheet Selection jpizzle[_8_] Excel Programming 4 June 13th 05 05:33 PM
Action on sheet Selection Piranha[_9_] Excel Programming 0 June 7th 05 08:59 AM
onClick action from cell selection Beanymonster Excel Programming 4 July 16th 04 09:25 PM


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