Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Reset to full rows visible

Trying the sub below from a Mike H post
How do I reset it to full rows visible if I were to click on a cell other
than A1 or A2?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
End Select
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Reset to full rows visible

try this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
Case Else
Rows("10:40").EntireRow.Hidden = False
End Select
End Sub

--


Gary

"Max" wrote in message
...
Trying the sub below from a Mike H post
How do I reset it to full rows visible if I were to click on a cell other than
A1 or A2?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
End Select
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Reset to full rows visible

Thanks, Gary
That works well


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Reset to full rows visible

Just from a user standpoint, I'd plop some buttons from the forms toolbar into
those cells and assign a macro to hide/unhide to each macro.



Max wrote:

Trying the sub below from a Mike H post
How do I reset it to full rows visible if I were to click on a cell other
than A1 or A2?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
End Select
End Sub


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Reset to full rows visible

This only takes up 3 lines:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Rows("10:40").EntireRow.Hidden = False
If Target.Address = "$A$1" Then Rows("10:20").EntireRow.Hidden = True
If Target.Address = "$A$2" Then Rows("21:40").EntireRow.Hidden = True

End Sub


I admit: It is not using Select...Case, which is normally preferable, but it
cuts down on the code, and makes it appear more neat :-)


CE

End SubMax wrote:
Trying the sub below from a Mike H post
How do I reset it to full rows visible if I were to click on a cell
other than A1 or A2?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
End Select
End Sub





  #6   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Reset to full rows visible

Thanks for your views, Dave


  #7   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Reset to full rows visible

Thanks for the alternative, Charlotte


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
full sheet charts not visible Stuart C.[_2_] Charts and Charting in Excel 1 June 19th 09 05:20 PM
Why full contents of cell visible only by double clicking? Venkat Excel Discussion (Misc queries) 1 October 10th 08 05:24 PM
Excel workbook contents only visible in Full Screen mode ... Sharon R. Excel Discussion (Misc queries) 0 April 2nd 08 12:26 PM
Rows not printing on full page Kelli Excel Discussion (Misc queries) 2 April 10th 07 07:42 PM
"Disk is Full" add-on question to "Can't reset last cell" post tod [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 02:32 AM


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