+ Reply to Thread
Results 1 to 3 of 3

copy data from a sheet in one workbook to a sheet with the same name in another workbook

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Pretoria
    MS-Off Ver
    Excel Latest Version
    Posts
    11

    copy data from a sheet in one workbook to a sheet with the same name in another workbook

    Dear all,

    I created a macro that open a second workbook when I open the first workbook. Both contains a "Contacts" worksheet that I reference in a few places. Both contact list are needed but I only maintain the one in the first workbook and then want to update the same sheet in the second workbook everytime I start the first one.
    At first I simply deleted the sheet in the second workbook; " WBOpen1.Sheets("Contacts").Delete " and then copy the same sheet from the fist workbook;
    " WBOpen.Sheets("Contacts").Copy After:=WBOpen1.Sheets(10) " . This works fine but then all the formulas in the second workbook that reference this worksheet loses it reference;
    for instance this formula " =IFERROR(VLOOKUP(D6,Contacts!$B$4:$G$278,5,FALSE),"------") " becomes this " =IFERROR(VLOOKUP(D6,#REF!,5,FALSE),"------") "

    Any suggestion will be highly appreciated

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: copy data from a sheet in one workbook to a sheet with the same name in another workbo

    When you delete a sheet all formulas pointing at that sheet goes in error... you could try to clear data and copy new data without delete the sheet.
    Try to change your code with:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Pretoria
    MS-Off Ver
    Excel Latest Version
    Posts
    11

    Re: copy data from a sheet in one workbook to a sheet with the same name in another workbo

    Hi Antonio
    thanx for that, it looks neat and will definately work, in fact I'm going to tr it as well. I did however tried with the code below and it also seems to solve my problem.

    Please Login or Register  to view this content.

+ 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