Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cam Cam is offline
external usenet poster
 
Posts: 165
Default Macro to hide rows?

Hello,

I have three sheets named 700, 800, 900 and other duplicate sheets named
A700, A800, A900, B700, B800, B900, etc. where 700 and A700 or B700 have the
duplicate information. Each day, I will go in sheet 700, 800 and 900 to hide
the rows that are completed (vary everyday).
How can I create a macro so that if 2 rows are hidden from sheet 700, then
it will automatically hide 2 rows from sheet A700 & B700, etc..(same for 800
and 900 sheet)? Sample of sheet 700 is:

Row A B C D E F G H I
1 Number Date Model Type ....................
2 1000 4/2/08 5000 A
3 1001 4/2/08 3000 B
4 1002 4/3/08 3000 B
5 1003 4/6/08 6000 A
6 1004 4/8/08 6000 B


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro to hide rows?

Try this macro. Alt F11. Insert Module. Paste into module. (save your
workbook before you start just in case it's not what you want). This assumes
that if you have row 2 hidden on the first sheet, you want it hidden on all
sheets with a similar name, for example.

Option Explicit
Sub HideRows()
Dim aWB As Workbook
Dim WS As Worksheet

Set aWB = ThisWorkbook

For Each WS In aWB.Worksheets
Call HideRowsOnOtherSheets(WS)
Next WS

End Sub

Sub HideRowsOnOtherSheets(myWS As Worksheet)
Dim aWB As Workbook
Dim WS As Worksheet
Dim lRow As Long
Dim myRange As Range
Dim r As Range

lRow = myWS.Cells(myWS.Rows.Count, 1).Resize(1,
myWS.Columns.Count).End(xlUp).Row
Set myRange = myWS.Cells(1, 1).Resize(lRow - 1 + 1, 1)

Set aWB = myWS.Parent
For Each WS In aWB.Worksheets
If WS.Name Like "*" & myWS.Name And WS.Name < myWS.Name Then
For Each r In myRange
If r.EntireRow.Hidden Then
WS.Cells(r.Row, r.Column).EntireRow.Hidden = True
End If
Next r
End If
Next WS

End Sub


--
HTH,
Barb Reinhardt



"Cam" wrote:

Hello,

I have three sheets named 700, 800, 900 and other duplicate sheets named
A700, A800, A900, B700, B800, B900, etc. where 700 and A700 or B700 have the
duplicate information. Each day, I will go in sheet 700, 800 and 900 to hide
the rows that are completed (vary everyday).
How can I create a macro so that if 2 rows are hidden from sheet 700, then
it will automatically hide 2 rows from sheet A700 & B700, etc..(same for 800
and 900 sheet)? Sample of sheet 700 is:

Row A B C D E F G H I
1 Number Date Model Type ....................
2 1000 4/2/08 5000 A
3 1001 4/2/08 3000 B
4 1002 4/3/08 3000 B
5 1003 4/6/08 6000 A
6 1004 4/8/08 6000 B


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
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Macro to hide rows lightbulb Excel Discussion (Misc queries) 4 July 11th 08 06:13 PM
macro to hide rows Mo2 Excel Programming 2 May 9th 07 12:30 PM
Macro to hide rows Alex Excel Programming 1 November 7th 05 07:09 PM
hide rows with macro Macro to hide rows in spreadwsheet Excel Discussion (Misc queries) 3 May 12th 05 05:02 PM


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