ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide same rows on new sheet as on previous (https://www.excelbanter.com/excel-programming/372778-hide-same-rows-new-sheet-previous.html)

[email protected]

Hide same rows on new sheet as on previous
 
Hello!

I have two sheets in my workbook. When I activate Sheet2 I want to hide
the same rows as on Sheet1. That means for example if row 14, 17 and 21
are hidden on Sheet1 I want to hide row 14, 17 and 21 on Sheet2 when I
activate that sheet.

Can someone please help me?

Regards,

S


Morris[_2_]

Hide same rows on new sheet as on previous
 
Hello!

I have two sheets in my workbook. When I activate Sheet2 I want to hide
the same rows as on Sheet1. That means for example if row 14, 17 and 21
are hidden on Sheet1 I want to hide row 14, 17 and 21 on Sheet2 when I
activate that sheet.


I don't really have tim e to test it, but it would go like this:

dim i as integer
i = 1

while (i < Sheets(1).usedrange.rows.count)

Sheets(1).Rows(i).Select
if (Selection.EntireRow.Hidden = True) then
sheets(2).rows(i).select
Selection.EntireRow.Hidden = True
end if

i = i + 1
wend



Hope it helps :)
Morris


[email protected]

Hide same rows on new sheet as on previous
 
Thank you!

// S

Morris skrev:

Hello!

I have two sheets in my workbook. When I activate Sheet2 I want to hide
the same rows as on Sheet1. That means for example if row 14, 17 and 21
are hidden on Sheet1 I want to hide row 14, 17 and 21 on Sheet2 when I
activate that sheet.


I don't really have tim e to test it, but it would go like this:

dim i as integer
i = 1

while (i < Sheets(1).usedrange.rows.count)

Sheets(1).Rows(i).Select
if (Selection.EntireRow.Hidden = True) then
sheets(2).rows(i).select
Selection.EntireRow.Hidden = True
end if

i = i + 1
wend



Hope it helps :)
Morris




All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com