![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
I am using the following code to copy a worksheet:
ActiveSheet.Copy Before:=Sheets("Main Menu") It is extremely slow in doing so. Is there better code I can be using to speed things up? I already have screen updating and calculation turned off.
__________________
Thanks in advance, Patrick |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Does the worksheet that you are copying contain a lot of data?
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
No not a tremendous amount. Last column used is AB. Last row used is 50. Should I maybe try deleting all of the blank rows and columns. There are about 4 buttons on the sheet however.
__________________
Thanks in advance, Patrick |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
As a rule of thumb, the less amount of formatting that you have to copy the faster it will be.
If there weren't any buttons I was going to ask you to try the following (not sure if it is faster though): Sheet2.Range(Sheet1.UsedRange.Address).Value = Sheet1.UsedRange.Value
__________________
Kind regards, Al Chara |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
The new sheet is not there until I copy the old one. I do not have any extra sheets to copy into.
__________________
Thanks in advance, Patrick |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Sheets.Add will add a blank sheet.
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
Thanks for all of the help so far. I would like to try first adding the blank sheet then setting its values equal to the other sheet.
However, how do I deal with the buttons?
__________________
Thanks in advance, Patrick |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
The following will do it:
ActiveSheet.Shapes.SelectAll Selection.Copy Sheet2.Activate ActiveSheet.Paste But it won't keep them in the same place.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
Thanks.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|