+ Reply to Thread
Results 1 to 5 of 5

Insert row macro at the end of a changing data set

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    Montreal, CA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Insert row macro at the end of a changing data set

    Hello guys,

    I currently have data inputted into a cell range from B7:I48 and I have a macro that when selected or executed will make a new row on line 49. If this button is selected again, it will add a row on 49 instead of at the end of the new dataset line 50. As the dataset expands down, I would like the macro to insert a row on the line right after the data set. My current code is as follows below. Please advise on how this code should be adjusted. Thank you very much.

    Please Login or Register  to view this content.
    Last edited by arlu1201; 06-03-2013 at 10:55 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Insert row macro at the end of a changing data set

    Will it always start at row 49?

    Do you have a sample that you can upload showing your data is structured? You can put dummy data as long as the format remains the same as your original.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-10-2013
    Location
    Montreal, CA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Insert row macro at the end of a changing data set

    Yes, the file will always insert a row on line 49 with the "insert row" button. For example, if you insert a row and enter data into line 49 and insert another row, the blank row will be row 49 and the row with data will be row 50 (instead of inserting a blank row into line 50). Please see attached for the file. Thank you.
    Attached Files Attached Files

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Insert row macro at the end of a changing data set

    So, you will have data uptil row 48, so the macro has to add a row at 49. Then at the end of the next dataset. How will the macro know where the next row should be inserted? Is there already a blank row there and you need another blank row to be added? Your sample shows only one dataset so its tough to make out.

    Or will there be some text in a particular cell? So if the macro finds that text, a row needs to be inserted?

  5. #5
    Registered User
    Join Date
    05-10-2013
    Location
    Montreal, CA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Insert row macro at the end of a changing data set

    Regardless of how many rows I have, I am trying to adjust the macro coding listed above that is in the form of an "Insert Row" button so that a blank row is always added to the row after the last row with data.
    For example, currently I have data inputted into cells B8:I48; therefore, I would want the "Insert Row" button to add a row to 49. If I have data inputted from B8:I55, I would want the "Insert Row" button to insert a row in row 56. If I have data inputted from B8:I60, I would want the "Insert Row" button to add a row on line 61, and so on.
    Yes, there is only one dataset. Thanks much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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