+ Reply to Thread
Results 1 to 7 of 7

VBA - Copy cells from changing sheet names

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    British Columbia, Canada
    MS-Off Ver
    Excel 2007
    Posts
    4

    VBA - Copy cells from changing sheet names

    Hello,

    Sorry if the title may not be the best description of what I am trying to do.

    I have a macro that copies 3 sheets in my workbook (Invoice1, PC1, CO1).

    It copies the data on the different sheets and creates new sheets for them, updating the sheet name to Invoice2, PC2, CO2, and so on (3,4,5..).

    I need formulas copied from the new PC to the new Invoice but I cannot find out how to make this work.

    Here is some code for my sheet creation:

    Please Login or Register  to view this content.



    So the invoice sheet which changes is titled InvoiceX. The other formulas the same with different variables (j and k instead of i, etc).

    Here is what I tried to do to copy formulas:

    Please Login or Register  to view this content.
    Can someone please shed some light on what I am doing wrong here?

    Please let me know if additional information is needed or if I was unclear in any explanations.

    Thanks in advance.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA - Copy cells from changing sheet names

    Do you have a sample file that you can upload?

    Am happy to see you using code tags despite being a new user to the forum.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA - Copy cells from changing sheet names

    you can copy entire sheet with
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-01-2012
    Location
    British Columbia, Canada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA - Copy cells from changing sheet names

    @ patel45 -First of all, thanks. Copying the entire sheet won't work in my scenario as it copies the old formulas as well. For example, while PC2 will grab the formula from PC1 which is correct, when I make PC3 it will also take the formula from PC1, and not PC2.

    @arlu1201 - Could you instruct me on how to upload?

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA - Copy cells from changing sheet names

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  6. #6
    Registered User
    Join Date
    08-01-2012
    Location
    British Columbia, Canada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA - Copy cells from changing sheet names

    I have removed a lot of data due to privacy etc as it is a company document.

    It should not affect the functionality of the spreadsheet.

    I have also used the " ' " to edit out some code, usually where it says 'delete maybe. Moving forward I probably would use this code because the copy entire spreadsheet command did not work out the way I wanted it to.

    Edit: Said macro is called PCALLFINAL2.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    British Columbia, Canada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA - Copy cells from changing sheet names

    helpmeV2.xlsm

    Still looking for assistance with this one.

    Use the revised attachment please.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1