+ Reply to Thread
Results 1 to 8 of 8

VBA code to copy a range from open workbook to another workbook

  1. #1
    Registered User
    Join Date
    02-12-2014
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    2

    VBA code to copy a range from open workbook to another workbook

    Looking for code to grab the name of a active worksheet and open another workbook find the same named work sheet and copy a data range to the second work book.

    Sheet names in both workbooks are the same. Jan 14, Feb 14, Mar 14,....

    I want the user to be able to update the date in a range of the first book the hit a button to update the second book and save the second book.

  2. #2
    Forum Contributor
    Join Date
    03-28-2013
    Location
    *
    MS-Off Ver
    Excel 2010
    Posts
    226

    Re: VBA code to copy a range from open workbook to another workbook

    may be this below.

    Please Login or Register  to view this content.
    Give Feedback and Click(*)

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA code to copy a range from open workbook to another workbook

    Hi, Frank Harrison,

    maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: VBA code to copy a range from open workbook to another workbook

    or
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA code to copy a range from open workbook to another workbook

    Hi, john55,

    any particular to build a range object on a Selection just to copy it?

    to whom it may concern:
    AFAIK the Aplication name should read Excel, not Exlcel.

    Ciao,
    Holger

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: VBA code to copy a range from open workbook to another workbook

    Hi HaHoBe,
    I am sorry if I did a mistake and I think I did answering, I do not want to upset anybody...
    I thought that the OP wants the user to be able to change the range...
    sorry again!

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA code to copy a range from open workbook to another workbook

    Hi, john55,

    don´t always be afraid that you may have done anything wrong - there´s nothing wrong with adding a sample code. It´s just a matter of me being curious as I personally would only set a Range if I were to use it for other purposes as well. The only purpose you use it for is to copy, and I guess that could be done without setting a range like in the original post. It´s a matter of taste (and I tend to have a bad taste these days ) - that´s all. And I tend to be asking things like the proper use of Variable way too much.

    And using Selection would make it unnecessary to hard code the ranges although I personally don´t like it too much if the user has to choose a range prior to running a macro (maybe you should add a code-line which refuses to run the code if only one cell is selected leaving it open if 2 selected cellls really is the range that shoulöd be copied, could be asked via MsgBox).

    And: no reason to be or feel sorry (from my point of view), any forum lives from people contributing, and if you stop doing so because I replied I would have to feel sorry.

    Ciao,
    Holger
    Last edited by HaHoBe; 03-01-2014 at 08:40 AM.

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: VBA code to copy a range from open workbook to another workbook

    Holger, Thx for your response!
    No problem, not at all! Frank did not specified that he used a specific range and then he said that he needed the user to be able to change...starting from here I thought that every time he has a different range and the user needs to select the desire area for copying.
    I am in a learning process!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to copy range from one workbook and paste to another open workbook
    By lilvictorians in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2013, 03:06 PM
  2. macro to copy cells(Range) from an open Workbook to another open Workbook.
    By jbester in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2013, 09:47 AM
  3. Macro, copy UNLOCKED cell range of sheet in open workbook to workbook template
    By NicksDad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-31-2012, 11:18 AM
  4. Simple task: Open a workbook, copy a range, paste into another workbook
    By fbonetti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2011, 01:12 PM
  5. Code to open a workbook , copy info and return it to another workbook using a cell v.
    By england79m in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2008, 11:22 AM

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