Copy before hidden sheet

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I am trying to insert a copied sheet before a hidden sheet, as it is now the
copy goes after the hidden sheet. Is there a modification to .copy before
to accomplish this or is unhide, copy, then re-hide the way to do it?

Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.Visible = False
.Copy Before:=Worksheets("Sheet2")
Sheets("Sheet2").Visible = True

Thanks
 
Steve,

You had 2 replies to this on 23rd. Did neither suit, and if not, what was
the problem?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Try making it visible before and hide it after

Worksheets("Data") .Visible = xlSheetVisible
....

Worksheets("Data") .Visible = xlSheetHidden

--

HTH

Bob Phillips
=========================
Try this

Application.ScreenUpdating = False
x = Worksheets("Data").Visible
If x <> True Then Worksheets("Data").Visible = True
....Copy Before:=Worksheets("Data") where DATA! is hidden
If x <> True Then Worksheets("Data") = xlVeryHidden
Application.ScreenUpdating = True

Chris

========================

Hi Steve,
What modification must be made to copy before when the sheet is hidden.
Example
.Copy Before:=Worksheets("Data") where DATA! is hidden. The copy ends up
after DATA rather than before.

Try this:

Worksheets("Sheet1").Copy After:=Worksheets("Data")
Worksheets("Data").Move After:=ActiveSheet

--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)
 

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

Back
Top