+ Reply to Thread
Results 1 to 10 of 10

Save 2 workbooks and assign a workbook name for copying cells

  1. #1
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Save 2 workbooks and assign a workbook name for copying cells

    I am trying to copy data from a log file to a summary file. I can open the workbooks successfully, but I can't identify them for the copy. Here is my code. Will someone please help?
    Please Login or Register  to view this content.
    Last edited by ka3pmw; 07-09-2021 at 05:44 PM. Reason: Incorrect Code

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,613

    Re: Save 2 workbooks and assign a workbook name for copying cells

    wkb is the workbook Log Summary.xlsm

    ThisWorkbook is the workbook that contains the macro code.

    Specifically what cells on what sheet are you copying and what is the destination?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    Source workbook is the Emergency Log ................... Destination Workbook is Log Summary
    Source Sheet is Form ............................................. Destination sheet is Sheet 1
    Cell D2 ................................................................... Cell D2
    Cell I3 ................................................................... Cell D3
    Cell J3 ................................................................... Cell F2
    Cell I1 ................................................................... Cell F3
    Cells B4:B152 ......................................................... Cells B4:B152

    These should get copied every time an entry is made. I can send you a copy of the workbooks if you wish.
    Last edited by ka3pmw; 07-10-2021 at 12:29 PM. Reason: Changed formatting and cells

  4. #4
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    Here are the workbooks. The password is ka3pmw
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    Here are the workbooks. The password is ka3pmw Emergency log
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    I have struggled with this and gotten it to this point:
    Please Login or Register  to view this content.
    Now I need to copy the cells. I have this but it crashes:
    Please Login or Register  to view this content.
    Does anyone have any ideas?

  7. #7
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    1,909

    Re: Save 2 workbooks and assign a workbook name for copying cells

    Try

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    maniacb,

    That returned a Runtime error 9 subscript out of range error.

  9. #9
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    Here is what I have. I start by using this to Set things up:

    Please Login or Register  to view this content.
    Then I use this to copy a cell:

    Please Login or Register  to view this content.
    and it does not work. The Workbooks("Source").Worksheets("Form").Range("D2").Copy _
    Workbooks("Dest").Worksheets("Sheet1").Range("D2") should execute every tine an entry is made/changed on the Forms sheet. I think I have it in a good place but I'm not sure. Does anybody know why or have a better idea?
    Last edited by ka3pmw; 07-11-2021 at 12:57 PM. Reason: Incorrect Code

  10. #10
    Registered User
    Join Date
    07-24-2016
    Location
    Mather, PA
    MS-Off Ver
    365
    Posts
    69

    Re: Save 2 workbooks and assign a workbook name for copying cells

    I now have the startup problem solved but I am having trouble with the copy portion. Here is the code that I am using:
    Please Login or Register  to view this content.
    I am getting an error 9 and I can't figure out where. This is the section of code that gets executed with every entry.

    The solution to the original problem was:
    Please Login or Register  to view this content.
    It is here that the variables are defined when the workbook is opened. Please look at this and advise.

+ 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. [SOLVED] VBA runtime Error. for copying cells from multiple workbooks to one master workbook.
    By mike rand in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-28-2018, 01:36 PM
  2. Help with copying data from cells in multiple workbooks to a master workbook
    By jamesh4ll in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2014, 05:28 PM
  3. [SOLVED] Multiple workbooks into one workbook - asked to save or not save each workbook step remove
    By Benji Jeff in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-20-2014, 09:54 PM
  4. Copying cells from multiple workbooks into a new workbook
    By bigalpha in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-21-2013, 06:30 AM
  5. [SOLVED] Copying cells from multiple closed workbooks to active workbook
    By Anonym216 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2013, 07:53 AM
  6. Conditioned copying/pasting of specific cells from multiple workbooks to master workbook
    By Ziad Homaidan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2013, 11:39 AM
  7. Replies: 1
    Last Post: 10-10-2012, 10:23 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