+ Reply to Thread
Results 1 to 7 of 7

Macro to open another workbook, copy and close

  1. #1
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Macro to open another workbook, copy and close

    ScreenHunter_019.jpg

    I need a macro

    1. open Book1.xlsm which name is kept at A2,
    2. copy range G3:J5 of [Book1]Sheet!1 to B2:E4.
    3. close this workbook and open next one at A5
    4. copy G3:J5 to B5:E7 this time.
    5. close and open next until end.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to open another workbook, copy and close

    Something like this:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: Macro to open another workbook, copy and close

    Quote Originally Posted by JBeaucaire View Post
    Something like this:
    Please Login or Register  to view this content.

    Yes! except it is not copied from Sheet1!G3:J5 but from B2:E4. Simple fine tune is required. Thank you very much

  4. #4
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: Macro to open another workbook, copy and close

    I only want to copy the value from Book1.xlsm, but the macro copy both the value and formula. How to modify the macro?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to open another workbook, copy and close

    Maybe:
    Please Login or Register  to view this content.
    Those ranges aren't the same shape?

    Please do not REPLY WITH QUOTE. That's just clutter, use the quick reply box below. Thanks.

  6. #6
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: Macro to open another workbook, copy and close

    Exactly what I want, thanks.

  7. #7
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: Macro to open another workbook, copy and close

    Hi JBeaucaire,

    Other than the cell values, I also want to copy the cell format, including conditional formatting. How to modify the Macro please?
    Last edited by kent97; 10-22-2016 at 01:46 AM.

+ 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. Copy from first workbook, close open new workbook paste close
    By johncarr1952 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-04-2021, 08:50 AM
  2. [SOLVED] Issue with Open, copy, close Macro - when trying to close workbook Clipboard error
    By seanpcorbett1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2016, 05:14 PM
  3. [SOLVED] Copy data from open to close workbook
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-17-2015, 08:04 PM
  4. Replies: 13
    Last Post: 11-29-2012, 08:25 PM
  5. Replies: 2
    Last Post: 09-11-2012, 09:42 AM
  6. How to open,save and close another workbook from the current workbook using macro?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 10:42 AM
  7. Workbook open, copy and close - Help
    By momossy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2010, 08:36 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