Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

copy and paste vb

Posted on 2011-03-02
5
Medium Priority
?
732 Views
Last Modified: 2012-08-14
Can some please help with the below.

Excel VB crashes on the paste section. Not sure why.
For temp_indx = 1 To temp_num_sheets
    Sheets(Array("one", "Chart_2")).Select
    Sheets(Array("one", "Chart_2")).Copy
    Sheets(Array("one", "Chart_2")).Paste 
    Sheets(Array("one", "Chart_2")).Protect Password:="asdf", DrawingObjects:=True, Contents:=True, Scenarios:=True
    Sheets(Array("one", "Chart_2")).Select
Next

Open in new window

0
Comment
Question by:jk_12
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Makrini
ID: 35024112
Looks to me like you are copying two sheets and trying to paste them on top of themselves multiple times.

  What are you actually trying to acheive?
0
 

Author Comment

by:jk_12
ID: 35024124
Thank you for the response.

I have an excel file which creates five unique reports. (Company 1, Company 2, etc).

Right now, it's 1 sheet report. I'm trying to add a second sheet into the automation process.
0
 
LVL 10

Accepted Solution

by:
Makrini earned 1000 total points
ID: 35024137
try

    Sheets(Array("one", "Chart_2")).Copy Before:=Sheets(1)

Open in new window

0
 

Author Closing Comment

by:jk_12
ID: 35024189
Thanks very much.
0
 
LVL 10

Expert Comment

by:Makrini
ID: 35024223
Glad to help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question