+ Reply to Thread
Results 1 to 7 of 7

Vba code to copy data to closed workbook

  1. #1
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Vba code to copy data to closed workbook

    Dear Members,

    I am looking for VBA which will complete my below task.

    • copy data from active worksheet to closed workbook.
    • Active sheet data should copy below old data of closed workbook.
    • data contain in A to K column of active worksheet.
    • clear copied data
    • If I moved both file any folder or drive, path should change automatically. ( something like fpath = current workbook path clworkbook= fpath & closedwbk.xls)




    Any Help may appreciated

    Thanks
    Last edited by satputenandkumar0; 04-24-2014 at 08:51 AM. Reason: grammer mistake
    Regards,
    Nandkumar S.
    ---------------------------------------------------------------
    Don't forget to Click on * if you like my solution.

  2. #2
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to copy data to closed workbook

    bump post .

  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 data to closed workbook

    Hi, satputenandkumar0,

    AFAIK you would need to open the closed workbook when relying on Excel VBA (you could either try using ADO or DAO to write to the closed workbook). Let´s see what steps you have so far to solve the problem.

    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
    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 data to closed workbook

    Hi, Hi, satputenandkumar0,,

    maybe give this code a try:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to copy data to closed workbook

    Dear sir,

    Thanks for giving me your valuable time.

    Method or data member not found, compile error is showing on below line

    Please Login or Register  to view this content.

  6. #6
    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 data to closed workbook

    Hi, satputenandkumar0,

    please adjust the name of the sheet for the constant to suit and correct the code-line to read
    Please Login or Register  to view this content.
    Sorry about that - nobody´s fault but mine.

    Ciao,
    Holger

  7. #7
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Vba code to copy data to closed workbook

    Sir,

    Thanks, I made below changes also.

    Please Login or Register  to view this content.
    &

    .ClearContents to .Clear ' to remove borders also


    Sorry for late reply

    You gave me perfect code. Thanks again

+ 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. VB code to copy from closed workbook
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-08-2014, 02:59 PM
  2. VBA code for copy data from closed workbook to "Data " sheet of current workbook
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-13-2014, 02:23 AM
  3. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  4. HELP Getting data from closed workbook using VBA code
    By persistent83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2013, 05:27 AM
  5. VBA Code to Copy and Move Closed Workbook
    By kozman2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2013, 09: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