Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default hide rows on different sheets


From my master sheet1 I want to select various rows to hide on a
corresponding sheet2 ie if sheet1!A3 = X then hide row 3 on sheet2; if
sheet1!A6=X then hide row 6 on sheet2 etc etc for any number of rows

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default hide rows on different sheets

On sheet 1 try this. You might want a master reset to scan all column A on
sheet1 for X's then hide/unhide Sheet1. If you do repost.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Target.Value = "X" Then
Sheet2.Rows(Target.Row).EntireRow.Hidden = True
Else
Sheet2.Rows(Target.Row).EntireRow.Hidden = False
End If
End If
End Sub

--

Regards,
Nigel




"Saintsman" wrote in message
...
From my master sheet1 I want to select various rows to hide on a
corresponding sheet2 ie if sheet1!A3 = X then hide row 3 on sheet2; if
sheet1!A6=X then hide row 6 on sheet2 etc etc for any number of rows

thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default hide rows on different sheets


Nigel
Brilliant!!
Thanks for the very quick reply as well

"Nigel" wrote:

On sheet 1 try this. You might want a master reset to scan all column A on
sheet1 for X's then hide/unhide Sheet1. If you do repost.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Target.Value = "X" Then
Sheet2.Rows(Target.Row).EntireRow.Hidden = True
Else
Sheet2.Rows(Target.Row).EntireRow.Hidden = False
End If
End If
End Sub

--

Regards,
Nigel




"Saintsman" wrote in message
...
From my master sheet1 I want to select various rows to hide on a
corresponding sheet2 ie if sheet1!A3 = X then hide row 3 on sheet2; if
sheet1!A6=X then hide row 6 on sheet2 etc etc for any number of rows

thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default hide rows on different sheets



Nigel
The master reset to scan colA for X's and hide/unhide would be realy useful
as well!!
Thank you


"Nigel" wrote:

On sheet 1 try this. You might want a master reset to scan all column A on
sheet1 for X's then hide/unhide Sheet1. If you do repost.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Target.Value = "X" Then
Sheet2.Rows(Target.Row).EntireRow.Hidden = True
Else
Sheet2.Rows(Target.Row).EntireRow.Hidden = False
End If
End If
End Sub

--

Regards,
Nigel




"Saintsman" wrote in message
...
From my master sheet1 I want to select various rows to hide on a
corresponding sheet2 ie if sheet1!A3 = X then hide row 3 on sheet2; if
sheet1!A6=X then hide row 6 on sheet2 etc etc for any number of rows

thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default hide rows on different sheets


Try this, it is a variation of the solution posted by Patrick Molloy, with
the addition of all rows unhide code. Note this can be run from a standard
code module, the two sheets named Sheet1 and Sheet2, if different change
were referenced in the code.



Sub ResetHiddenRows()
Dim addr As String
Dim cell As Range

' clear hidden rows
With Sheets("Sheet2")
.Rows("1:" & .Rows.Count).EntireRow.Hidden = False
End With

' hide selected rows
With Sheets("Sheet1")
Set cell = .Range("A:A").Find("X")
If Not cell Is Nothing Then
addr = cell.Address
Do
Worksheets("Sheet2").Rows(cell.Row).Hidden = True
Set cell = .Range("A:A").FindNext(cell)
Loop Until cell.Address = addr
End If
End With
End Sub

--

Regards,
Nigel




"Saintsman" wrote in message
...

Nigel
The master reset to scan colA for X's and hide/unhide would be realy
useful
as well!!
Thank you


"Nigel" wrote:

On sheet 1 try this. You might want a master reset to scan all column A
on
sheet1 for X's then hide/unhide Sheet1. If you do repost.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Target.Value = "X" Then
Sheet2.Rows(Target.Row).EntireRow.Hidden = True
Else
Sheet2.Rows(Target.Row).EntireRow.Hidden = False
End If
End If
End Sub

--

Regards,
Nigel




"Saintsman" wrote in message
...
From my master sheet1 I want to select various rows to hide on a
corresponding sheet2 ie if sheet1!A3 = X then hide row 3 on sheet2; if
sheet1!A6=X then hide row 6 on sheet2 etc etc for any number of rows

thanks






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default hide rows on different sheets


several ways to do this. You could use the sheet's change event or the
sheets calculate event.
Here's the code:

Option Explicit
Private Sub Worksheet_Calculate()
CheckForX
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then CheckForX
End Sub
Sub CheckForX()
Dim addr As String
Dim cell As Range
Set cell = Range("A:A").Find("X")
If Not cell Is Nothing Then
addr = cell.Address
Do
Worksheets("sheet2").Rows(cell.Row).Hidden = True
Set cell = Range("A:A").FindNext(cell)
Loop Until cell.Address = addr
End If
End Sub

to get to the sheet's code page, just right click the tab and select View
Code from the popup menu

whenever a cell's value changes - user entry - the change event fires -
triggering the change event ...


"Saintsman" wrote in message
...
From my master sheet1 I want to select various rows to hide on a
corresponding sheet2 ie if sheet1!A3 = X then hide row 3 on sheet2; if
sheet1!A6=X then hide row 6 on sheet2 etc etc for any number of rows

thanks


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
How to hide rows in a Workbook with multiple sheets with zero valu khurram_razaq Excel Programming 6 June 6th 08 02:18 PM
Hide rows with zero's on several sheets within a workbook khurram_razaq Excel Programming 11 June 6th 08 01:02 PM
Specify which rows to NOT hide, and have excel hide the rest Mo2 Excel Programming 0 April 25th 07 03:44 AM
Hide rows and update fileds in different sheets Carlos Canstatt Excel Discussion (Misc queries) 1 November 2nd 05 02:47 AM
Hide Rows Across Mulitple Sheets Jason Penny Excel Programming 2 September 22nd 03 06:30 PM


All times are GMT +1. The time now is 02:18 AM.

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"