copy sheet macro problem

dado6612

Well-known Member
Joined
Dec 4, 2009
Messages
591
Hi to all

I have recorded macro which copy Sheet1
That works fine until Sheet1 is veryhidden
Sheet1 suppose to be veryhidden cause its template sheet
So, when user fill up sheet2 he need to press button and he will get Sheet1, named Sheet3, u know how that works

I tried avoid that by this:

Code:
Sub copy()
Sheet1.Visible = xlSheetVeryHidden = False
    Sheets("Sheet1").Select
    Sheets("Sheet1").Copy Before:=Sheets(1)
Sheet1.Visible = xlSheetVeryHidden = True
End Sub

That didn't help me, I get part "Sheets("Sheet1").Select" colored yellow

I don't know how to fix this, can someone help me?

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi

VoG, I just realized, it copy sheet to end, I need to copy sheet to start, before previous one

Now its
Sheet1(1)/Sheet1(2)/Sheet1(3)
I need
Sheet1(3)/Sheet1(2)/Sheet1(1)

Its great what code automatically hide original Sheet1, so its needed just to change place for copy new sheet

I tried by changing code to..
Code:
Sub copysheet()
Application.ScreenUpdating = False
With Sheet1
    .Visible = xlSheetVisible
    .copy [COLOR=Red]before[/COLOR]:=Sheets(Sheets.Count)
    .Visible = xlSheetVeryHidden
End With
Application.ScreenUpdating = True
End Sub
..but it still move it to end

Thanks :)
 
Upvote 0
Try

Code:
Sub copysheet()
Application.ScreenUpdating = False
With Sheet1
    .Visible = xlSheetVisible
    .Copy before:=Sheets(1)
    .Visible = xlSheetVeryHidden
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Yep, that's it
But it takes like 5 seconds to finish :confused:
Is problem in mine laptop or in excel?

Ok, nevermind, thanks :biggrin:
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top