+ Reply to Thread
Results 1 to 8 of 8

Getting my loop statements to paste at next empty row

  1. #1
    Registered User
    Join Date
    04-20-2017
    Location
    Katy, Texas
    MS-Off Ver
    2016
    Posts
    6

    Getting my loop statements to paste at next empty row

    I am new to VBA and am trying to get my 2nd, 3rd, 4th loops to paste at the next empty row after the previous loop finishes.

    Here is what I have so far:

    Please Login or Register  to view this content.
    I can get it work properly if I adjust this value "ii = ii + 1" for each loop, but I would like it to be dynamic.

    Appreciate any help or insights.
    Last edited by craving77494; 04-23-2017 at 08:48 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting my loop statements to paste at next empty row

    Hi Katy and welcome to the forum.

    Please note Rule 3 of our forum baout using code tags
    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    In addition upload your workbook so that we can see the request in context. It may also be the case that your goal could be achieved without a loop.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-20-2017
    Location
    Katy, Texas
    MS-Off Ver
    2016
    Posts
    6

    Re: Getting my loop statements to paste at next empty row

    Thank you for the guidance. I have fixed to "code" tags but an unable to get the attachment button to work for me.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting my loop statements to paste at next empty row

    Yes, the paperclip 'attach' icon is a continuing problem - no don't ask!

    You'll need to click the Go Advanced button at the bottom right of the posting window then look underneath for the Manage Attachments option...

    @Jerry/Ford if you happen to see this. Any chance the Tech Team could get around to addressing this nuisance factor?

  5. #5
    Registered User
    Join Date
    04-20-2017
    Location
    Katy, Texas
    MS-Off Ver
    2016
    Posts
    6

    Re: Getting my loop statements to paste at next empty row

    Thanks for the help I have attached a copy of the Workbook.
    Attached Files Attached Files

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting my loop statements to paste at next empty row

    That's one of the longest procedures I've ever seen, and it wasn't made easy to find by having the DIM statements way down the procedure.

    It's good programming practice to put all Dim statements at the top of a procedure and usual and much better to break a big procedure down into small sections of code, and call a sub section when necessary (passing any variables with the calling statement).

    I'm finding it hard therefore to understand what the macro is trying to do.

    Would you describe in a narrative form what the macro is supposed to do, which sheet(s) it operates on and where results are supposed to end up.

  7. #7
    Registered User
    Join Date
    04-20-2017
    Location
    Katy, Texas
    MS-Off Ver
    2016
    Posts
    6

    Re: Getting my loop statements to paste at next empty row

    Thanks Richard,

    I will make the adjustments to the code as recommended.

    The part I need help with is below:
    '***************************** Begin loading Asset Attributes *****************************
    I hope the additional comments within the code will explain it a little better?


    Please Login or Register  to view this content.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting my loop statements to paste at next empty row

    Hi,

    I question whether a loop is necessary. Loops are inherently slow since there's a time overhead each time VBA jumps back to the Excel App, does stuff and then returns.

    The fastest and most efficient way I know of doing these sorts of things is to use Data Filter and copy the filtered data using the xlCellTypeVisible syntax and paste to the appropriate place.

+ 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. Paste Values empty cell, not empty
    By warston in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 12-23-2020, 08:16 PM
  2. [SOLVED] need snippet to check two cells and paste into them if empty. if neither is empty, next i
    By Royzer in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2016, 07:17 PM
  3. Copy/Paste to Next Empty Row Overwriting Previous Row When Column A Is Empty
    By grantfitz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2013, 04:34 PM
  4. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  5. [SOLVED] Handling empty If Statements
    By a8747 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-05-2013, 04:21 AM
  6. copy paste from row above loop until last non empty row
    By jmoe007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2011, 04:19 PM
  7. Macro Loop and Paste in next empty row
    By Rayhoop in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2008, 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