+ Reply to Thread
Results 1 to 11 of 11

VBA Code to paste on next available line not working?

  1. #1
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    VBA Code to paste on next available line not working?

    Good day all,

    Once again in desperate need of an excel guru, I have a spreadsheet that allows the user to populate their own "Safe Work Method Statements" by way of check boxes, however there will be a number of Safe Work Procedures required & the problem I am having is every time a check box is ticked it replaces the original procedure but i require it to populate below the last on the same specified sheet ("Page4+)


    Please Login or Register  to view this content.

    Any advise would be immensely appreciated, thank you all & have a great day, Marco
    Attached Files Attached Files
    Last edited by matrixpom; 10-21-2012 at 05:28 PM.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: VBA Code to paste on next available line not working?

    hi,

    See if this code helps.
    Please Login or Register  to view this content.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VBA Code to paste on next available line not working?

    Hi matrixpom,

    See if change this line of code...

    Please Login or Register  to view this content.
    ...to this helps:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Re: VBA Code to paste on next available line not working?

    Hi Charles,

    Still doesn't seem to work, I had a response from another site that appears to populate as needed but still appears a little "hit & miss". The original Spread Sheets with the Safe Work Method Statements were cut & pasted with merged cells...think this may be causing the issue? Thanks Charles - Marco

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: VBA Code to paste on next available line not working?

    Hi,

    The code I supplied worked for me.

  6. #6
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Re: VBA Code to paste on next available line not working?

    Hi Trebor 76,

    Still no joy, think I may have to go back to the drawing board, maybe if I give each safe work procedure a named range? Thanks guys - Marco

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VBA Code to paste on next available line not working?

    I had a response from another site
    Without providing a link to that thread you're braking the forum rule of cross-posting!!

    I think the code Charles provided will offset the column by one, not the row.

    You're using merging cells in your data which plays havoc when trying to set row and/or column variables with VBA, though my code seemed to work fine for me.
    Last edited by Trebor76; 10-21-2012 at 06:45 PM.

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VBA Code to paste on next available line not working?

    For reference this is also posted here

  9. #9
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Re: VBA Code to paste on next available line not working?

    Sorry for that Trebor76 & thank you for your assistance, have a great day - Marco

  10. #10
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: VBA Code to paste on next available line not working?

    Hi,

    The problem you are having is you are trying to get the last empty row using a defined range.
    When you do the first copy past the defined range remains the same. You need to redefine the name range.
    The following code looks at column M for the last empty row.
    It makes the assumption it will alway have data.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Re: VBA Code to paste on next available line not working?

    Thank You Charles - Marco

+ 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