+ Reply to Thread
Results 1 to 21 of 21

Modify Existing Mbr Code to Save to Ext.Workbook

  1. #1
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Modify Existing Mbr Code to Save to Ext.Workbook

    Morning All,

    The code attached was provided within this forum, but I think I borked it cause it's not quite doing what I'm needing. Intended theme, to add data cells to next available area of the DB skipping the header row. The row column search for finding next available area should be defined by column G, H or I of the "DB"

    1.) I need the active sheet - Sheets("Master (2)") - to copy only the data filled cells in the range of A:R to my - Sheets("DB") - in range G:X skipping the header row (Row 1)
    2.) Additionally, I need to copy from ("Master (2)") active cells in Column AA to ("DB") Column Y following the same 'find next available cell' philosophy.

    *Edit

    3.) Sorry, will also need columns G:Y of the "DB" to sort by
    A.) Property Case ; Values ; A to Z
    B.) Date ; Values ; Newest to Oldest.

    Thank you very much!

    Please Login or Register  to view this content.
    Last edited by Miskondukt; 03-01-2013 at 07:59 PM.

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

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Try this

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Thanks for taking care of the skip first row addition; however, any additional code for the remainder of what I'm trying to do?

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

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Here she is. Please review the OP as I made ONE minor change to range.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Friendly bump

  7. #7
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Sorry guys, but bumpity bump again.

  8. #8
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Hey everyone. Any chance of possibly getting some help on this one?

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Hi miskondukt

    This Code is in the attached...let me know of issues.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    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.

  10. #10
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Fantastic! Thank for getting this going. Excellent job.
    Last edited by Miskondukt; 02-28-2013 at 05:04 PM.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    You're welcome...glad I could help. Thanks for the Rep.

  12. #12
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Quote Originally Posted by jaslake View Post
    Hi miskondukt

    This Code is in the attached...let me know of issues.
    Please Login or Register  to view this content.
    Can someone please modify this code to save the file to an external workbook? C:\Users\Miskondukt\HUD DB[Database.xlsx] for example.

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Hi miskondukt

    Try this
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Sorry, was entirely my fault. I wasn't clear on the request.

    What I'm needing is the "Set ws1 = Sheets("DB")" the copy and paste data, to be saved to an external document. Will the code provided function that way?

    Quote Originally Posted by jaslake View Post
    Hi miskondukt

    Try this
    Please Login or Register  to view this content.

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Hi miskondukt

    Please don't quote entire Posts...quote only the items that are relative to your new Post.

    If I understand your issue try this Code to
    the copy and paste data, to be saved to an external document
    Change the three lines as indicated.
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Good Morning,

    After changing the lines as indicated, I got a "Compile Error: Type mismatch" for the following line:

    Please Login or Register  to view this content.
    That I had changed to:

    Please Login or Register  to view this content.
    OR should this just indicate the Tab name of the document that wb2 is instructed to open?

    I used =cell("filename") to extract the exact name to use.
    Last edited by Miskondukt; 03-06-2013 at 01:05 PM.

  17. #17
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Hi miskondukt

    This line of Code
    Please Login or Register  to view this content.
    is setting ws2 to the name of the Worksheet you wish to use in the Workbook you opened here
    Please Login or Register  to view this content.
    What's the Name of that Worksheet you wish to use?

  18. #18
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    The worksheet in the opening filename is "DB"

    Please Login or Register  to view this content.
    Produced ExtDBError.PNG
    The attached image shows a "DB" at the end of the file location. I had removed that after this error since we're setting the worksheet via ws2 but it still produced the same error. It appears to be adding an "xlsx" in itsself when searching for the macro-enabled document. I suppose this DB doc could be without macros, if that makes any difference.

    And the full file name of the document is as listed above.


    The entire code:

    Please Login or Register  to view this content.
    Last edited by Miskondukt; 03-06-2013 at 02:07 PM.

  19. #19
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Hi miskondukt

    Were I you I'd ditch the shorthand. I'd write this line of Code
    Please Login or Register  to view this content.
    like this
    Please Login or Register  to view this content.
    and see what it does...get back to me.

    Of course, I'm assuming you've checked the Path???

  20. #20
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    Re: Need VBA to Auto Update to Database - Phail Code Included

    Path had been confirmed, code worked...All is good brotha.

    Thank you, again, very much!

  21. #21
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Need VBA to Auto Update to Database - Phail Code Included

    You're welcome...glad I could help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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