+ Reply to Thread
Results 1 to 7 of 7

Creating a Macro which inputs # of rows based on cell value

Hybrid View

  1. #1
    Registered User
    Join Date
    06-27-2015
    Location
    Omaha
    MS-Off Ver
    2010
    Posts
    3

    Creating a Macro which inputs # of rows based on cell value

    Hi everyone,

    Hope you're having a great weekend!

    I am attempting to build a macro which generates x amount of rows bases on the number located in a specific cell (S2).

    Can anyone provide any support or direction on where I can start? I create/utilize Macros daily, but am stuck with this one. In addition, how can I input a value in those newly created rows, based on a cell value found in the primary row?

    Thanks in advance for your assistance!

    -Nate

  2. #2
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Creating a Macro which inputs # of rows based on cell value

    Something like:

    Sub insert()
    Do Until n = Range("S2").Value
    Rows(3).insert
    n = n + 1
    Loop
    End Sub
    !If all your troubles are solved, then so is the thread. Show this by marking it so using thread tools at the top of the page.
    If I helped do this, then please show your appreciation by awarding rep points.
    <------ Button for that is over there

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Creating a Macro which inputs # of rows based on cell value

    Assuming you wanted these rows inserted at row 3

    Sub insertrows()
    
    Range("S3").Resize(Range("S2").Value).EntireRow.insert
    
    End Sub

  4. #4
    Registered User
    Join Date
    06-27-2015
    Location
    Omaha
    MS-Off Ver
    2010
    Posts
    3

    Re: Creating a Macro which inputs # of rows based on cell value

    Awesome, thank you to both of you! Now that I have the rows created, how can I take a value found in Columns N-R, and insert it into the cells found in Column C?Macro Help.JPG

  5. #5
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Creating a Macro which inputs # of rows based on cell value

    Which value are you trying to take from columns N-R?

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Creating a Macro which inputs # of rows based on cell value

    Based upon your picture it doesn't look like anything other than Onshore should go in column C

  7. #7
    Registered User
    Join Date
    06-27-2015
    Location
    Omaha
    MS-Off Ver
    2010
    Posts
    3

    Re: Creating a Macro which inputs # of rows based on cell value

    I want to take the numerical values found in columns n-r, and place that many of the associated header of columns n-r, in column C. Can that be done?

+ 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. Creating a userform? That would have 3 buttons and inputs would control the macro?
    By Mr_Bill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2014, 12:41 PM
  2. Need help creating macro to hide rows based upon whether 1 of 3 rows have data
    By BigEdJr in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-17-2014, 02:58 PM
  3. Replies: 2
    Last Post: 08-20-2013, 08:36 AM
  4. How to delete rows based on inputs from 2 columns?
    By Woody13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-02-2013, 02:26 PM
  5. Creating new columns based on inputs
    By A Gentleman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-04-2008, 05:29 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