+ Reply to Thread
Results 1 to 3 of 3

Copy one workbook, paste to another; non-continuous cells

  1. #1
    Registered User
    Join Date
    11-13-2014
    Location
    Riverside, CA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Copy one workbook, paste to another; non-continuous cells

    First, I am new to VBA and trying very hard to figure out and do for myself, but have run into some issues that I haven't been able to resolve for several days now... If you spot any novice mistakes, I would gladly welcome your comments in which I can be educated on proper code form.

    Issue: I am working to have non-continuous cells from a workbook (WB1, Report.xlsm *attached) paste into another open workbook (WB2, Log.xlsm *attached). Basically it is a report form (WB1) that is updating a log (WB2).

    Order of operations I am hoping for:
    Someone fills out the report, then clicks a button to have the following happen:
    1. Log (WB2) opens
    2. Report (WB1) copy non-adjacent cells (ex. B6, B8, C38, etc)
    3. Paste to Log (WB2) in the next open row (NextRow in my code)
    4. Log (WB2) saves and closes
    5. Report (WB1) saves and closes

    I have been stepping into the code and have found the fail point; all seems to work appropriately until that point. I have made the fail point the end of the code listed here. I was able to get the last row of code to paste to the same workbook with "A1" row/cell format, but can't get it to work to paste to WB2 or with "NextRow"

    I have a sneaky suspicion that I need to define more subs to prevent overlap in all the stuff I have written here, but don't know enough yet to accurately diagnose this.

    Any suggestions are greatly appreciated as I continue to learn more about vba code!

    Please Login or Register  to view this content.
    Additional code, to the end of the sub, that I haven't check yet, since I wanted to get the above to work is as follows:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by antelope; 12-17-2014 at 01:55 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Copy one workbook, paste to another; non-continuous cells

    Work on this, you can..
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-13-2014
    Location
    Riverside, CA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Copy one workbook, paste to another; non-continuous cells

    I bow to you davesexcel! Not only did you greatly increase the readability of my code (thank you, and believe me, I have taken many notes on coding in this style from now on!), but this worked fabulously. Thank you for contributing to a "win" for me today- I am SO stoked to play with this some more and continue learning and tinkering. Thank you a million times over!!

    It's amazing how when you start as a newbie you end up with so many redundancies and unnecessary components, then you see what the code should actually look like, and do a *FACEPALM* and exclaim "DOH!"

    Because of your help, I was actually able to use code that I originally started with, but later abandoned out of frustration, for the non-adjacent cells to be copied.

    Just to give you an idea of what amendment I made to your suggestion:

    Please Login or Register  to view this content.
    Thank you again, I greatly appreciate your help and guidance.

+ 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] Copy Filter Data and paste it on another workbook with special cells(Only Visible Cells)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-13-2014, 07:59 AM
  2. [SOLVED] Continuous column copy / Non-continuous column paste (VBA)
    By macrorookie in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-05-2014, 11:35 PM
  3. [SOLVED] Copy Specific Cells Across all worksheets in a Workbook and Paste Into single New Workbook
    By thunt13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2013, 10:43 AM
  4. Copy not continuous ranges and paste it new word file
    By suny100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2012, 02:16 PM
  5. Copy and paste non consecutive cells and paste consecutively in another workbook
    By macquhele in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2011, 02:36 PM

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