Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
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
Hidden rows unhide by themselves Cobaum Excel Discussion (Misc queries) 1 June 27th 09 12:42 AM
hidden rows unhide on their own Dave Murto Excel Discussion (Misc queries) 3 August 12th 08 10:28 PM
unhide row does not unhide the hidden rows nikita Excel Worksheet Functions 4 May 24th 08 02:59 PM
macro that brings user to cell based on "yes/no" response lennyx2 Excel Discussion (Misc queries) 2 February 9th 05 02:47 PM
Why cannot I unhide the hidden rows ? Jim Edwards Excel Discussion (Misc queries) 2 December 4th 04 04:38 PM


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