LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Code to Unhide set of rows (SC).

I'm designing a form where Cell A5, which is named Off_Num. This cell
has Values (Select One, 1 to 20) in a dropdown, and Rows 9 to 28 are
hidden.
Now if 1 is selected in Off_Num cell then, the code should Unhide Row
9. And if 2 is selected then Row(9:10) should be unhidden so on, till
if 20 is selected the Rows(9:28) should be unhidden. And if Select
One
option is selected that Rows(9:28) should get hidden again.
Mr. JE McGimpsey'S Reply

One way:
Put this in your worksheet code module:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Range("Off_Num")
If Not Intersect(.Cells, Target) Is Nothing Then
Application.ScreenUpdating = False
Rows("9:28").Hidden = True
If IsNumeric(.Value) Then
Rows("9:9").Resize(CLng(.Value)).Hidden = False
End If
Application.ScreenUpdating = True
End If
End With
End Sub
This code Hides and unhides single row. Now how can I modify this code
to unhide a set of rows.
My form has a cell named Mod_Num which has values (Select one, 1to5)
in a dropdown.
The code has to work in such a way that when I select 1, in cell
Mod_Num then rows range (17:22) should unhide. On selecting 2, rows
(17:27) should unhide. On selecting 3, rows (17:32) should unhide. On
selecting 4, rows (17:36) should unhide. And lastely on selecting 5
the complete row range (17:41) should unhide.

On selecting Select one from drop down the row range(17:36) should
hide.
The above code works for unhiding single rows, so I think little
modification needs to be made for the above code to unhide set of
rows. Please help me modify this code.

Thanks for your help.

 
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
Code to Unhide Rows using Macro Rajat Excel Worksheet Functions 7 January 14th 10 06:56 PM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
unhide row does not unhide the hidden rows nikita Excel Worksheet Functions 4 May 24th 08 02:59 PM
VB Code to hide and unhide rows Raj Excel Discussion (Misc queries) 2 February 27th 08 05:58 AM
Code for button to hide/unhide rows Chris Excel Worksheet Functions 5 March 5th 07 06:15 AM


All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"