Hide same rows on new sheet as on previous

S

staeri

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
 
M

Morris

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
 
S

staeri

Thank you!

// S

Morris skrev:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top