PC Review


Reply
Thread Tools Rate Thread

Action from list selection

 
 
Maze
Guest
Posts: n/a
 
      24th Aug 2009
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 With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      25th Aug 2009
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.Hidden = 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 With Quote
 
Maze
Guest
Posts: n/a
 
      26th Aug 2009
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.Hidden = 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Take Action on Cells within Selection Mike G - D.C. Microsoft Excel Programming 3 29th Jun 2009 10:00 PM
action upon selection =?Utf-8?B?Qm9yaXNT?= Microsoft Excel Programming 1 30th Aug 2007 11:30 AM
selection action =?Utf-8?B?R2FyeQ==?= Microsoft Access VBA Modules 3 11th Dec 2006 04:58 AM
Action on sheet Selection jpizzle Microsoft Excel Programming 4 13th Jun 2005 05:33 PM
limit cell list selection based on the selection of another list =?Utf-8?B?bG9ycmFpbmU=?= Microsoft Excel Worksheet Functions 2 14th Dec 2004 08:17 PM


Features
 

Advertising
 

Newsgroups
 


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