+ Reply to Thread
Results 1 to 7 of 7

How do I use a button to insert a specified number of rows in a table?

  1. #1
    Registered User
    Join Date
    05-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    How do I use a button to insert a specified number of rows in a table?

    Hello,

    First of all I should say that I have extremely limited knowledge of VBA, so thanks in advance for any assistance and patience.

    What I would like to be able to do is to use a button to automatically insert a number of rows in a table, copying formats, formulas and values to the new rows. The number of new rows inserted should be based on a value in a cell at the top of the worksheet. The worksheet would consist of an input cell at the top, button and then a table with header rows and the first row of the table (with formulas)

    The process as I see it would work as follows:
    1. Type a number into the input cell (say 50)
    2. Click the button
    3. Clicking the button then automatically inserts 50 rows (or rather 49 as the first row is already there) into the table, copying down formats, formulas and values.

    I feel like this should be straightforward, but I don't know how to link the input cell to the button and then what code is used to get the button to insert the rows.

    Thanks!

  2. #2
    Registered User
    Join Date
    09-04-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How do I use a button to insert a specified number of rows in a table?

    1 way would be pre-defining the input cell as say "A3" and basing your code around that. Your button could be placed anywhere and u could just assign the macro to it so whenever it is clicked, the macro starts.

  3. #3
    Registered User
    Join Date
    05-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How do I use a button to insert a specified number of rows in a table?

    Thanks poorcloud - the input cell is predefined. However, it's the coding that I have an issue with - as I said I'm really a beginner.

  4. #4
    Registered User
    Join Date
    09-04-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How do I use a button to insert a specified number of rows in a table?

    Is this what you mean?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How do I use a button to insert a specified number of rows in a table?

    Thanks for the quick reply again. It's not really what I mean though - that might solve part of the problem, but it wouldn't link to the input cell or the table.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How do I use a button to insert a specified number of rows in a table?

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  7. #7
    Registered User
    Join Date
    05-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How do I use a button to insert a specified number of rows in a table?

    Hi Norie,

    Many thanks. Please see attached. I have added in comments on what I would like this worksheet to do. It would be great to understand how to make this work.

    SolarPV.xlsx

+ 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. Insert rows in linked table that are added to secondary table
    By Ida LaValley in forum Excel General
    Replies: 4
    Last Post: 11-16-2020, 12:00 PM
  2. Button to insert report number from a list
    By alexander.small in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 12-05-2013, 07:56 AM
  3. Insert new rows below once the button to add new row is clicked
    By dearsurabhi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2013, 05:30 AM
  4. Macros: Insert Rows/Submit Button
    By den88 in forum Excel General
    Replies: 1
    Last Post: 12-03-2010, 04:50 PM
  5. Insert rows and formulas above Button
    By alexandruc in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 03-17-2010, 02:52 AM

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