Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VB to unhide hidden rows based on user response
I have 10 rows in groupings of 2 (total of 5 groupings) that are
hidden. Based on user input in a cell I want to unhide the rows. The user will input a number from 1 to 5 in cell A15. Each number is to unhide 2 rows progressively. (Currently 20/21, 22/23, 24/25, 26/27, 28/29) Example: User input of 1 will unhide 20 and 21. An input of 2 will unhide 20, 21, 22, and 23. An input of 3 will unhide 6 rows. Etc. Can VB do this? (If so where can I find the code or can you write it here.) Can it be automatic anytime that cell is changed or will I need to create a button to run the specified macro code. (The automatic is better but will take what I can get.) Any help you can offer would be apprecaited. Dave |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VB to unhide hidden rows based on user response
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
if Target.count 1 then exit sub if Target.Address = "$A$15" then Rows(20).Resize(10).Hidden = True if Target.Value =1 and Target.Value <= 5 then _ Rows(20).Resize(Target.Value*2).Hidden = False End if End Sub Right click on the sheet tab and select view code. Put in code similar to the above code. -- Regards, Tom Ogilvy Lost wrote in message ... I have 10 rows in groupings of 2 (total of 5 groupings) that are hidden. Based on user input in a cell I want to unhide the rows. The user will input a number from 1 to 5 in cell A15. Each number is to unhide 2 rows progressively. (Currently 20/21, 22/23, 24/25, 26/27, 28/29) Example: User input of 1 will unhide 20 and 21. An input of 2 will unhide 20, 21, 22, and 23. An input of 3 will unhide 6 rows. Etc. Can VB do this? (If so where can I find the code or can you write it here.) Can it be automatic anytime that cell is changed or will I need to create a button to run the specified macro code. (The automatic is better but will take what I can get.) Any help you can offer would be apprecaited. Dave |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VB to unhide hidden rows based on user response on a different sheet
On Tue, 19 Aug 2003 00:46:31 -0400, "Tom Ogilvy"
wrote: Private Sub Worksheet_Change(ByVal Target As Excel.Range) if Target.count 1 then exit sub if Target.Address = "$A$15" then Rows(20).Resize(10).Hidden = True if Target.Value =1 and Target.Value <= 5 then _ Rows(20).Resize(Target.Value*2).Hidden = False End if End Sub Right click on the sheet tab and select view code. Put in code similar to the above code. Tom O provided some great code to hide/unhide rows on a sheet based on a user input. I am running into a slight problem I need a little guidance. I have Sheet 1 and Sheet 5. I want the input from Sheet 1 to modify the rows on sheet 5. I know this is wrong code but it is what I have so far: Private Sub Worksheet_Change(ByVal Target As Excel.Range) ' Checks Part Time Labor Types If Target.Count 1 Then Exit Sub If Target.Address = "!Sheet1$F$16" Then Rows(8).Resize(7).Hidden = True If Target.Value = 1 And Target.Value <= 5 Then _ Rows(8).Resize(Target.Value + 2).Hidden = False End If End Sub I know the problem lies with the 4th live down. I want the user input from cell F16 on sheet one to effect the rows on sheet 5. (In this case row 8 and the following 7 rows.) Can someone help fine tune that 4th line. Thanks RU |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hidden rows unhide by themselves | Excel Discussion (Misc queries) | |||
hidden rows unhide on their own | Excel Discussion (Misc queries) | |||
unhide row does not unhide the hidden rows | Excel Worksheet Functions | |||
macro that brings user to cell based on "yes/no" response | Excel Discussion (Misc queries) | |||
Why cannot I unhide the hidden rows ? | Excel Discussion (Misc queries) |