+ Reply to Thread
Results 1 to 5 of 5

Macro to insert a variable number of rows into a variable location

  1. #1
    Registered User
    Join Date
    03-06-2015
    Location
    Newcastle, England
    MS-Off Ver
    2013
    Posts
    26

    Macro to insert a variable number of rows into a variable location

    Hi all,

    So my VBA skills aren't great and this has me stumped...

    I have 2 sheets, one called 'Plan' that tracks project work with columns that contain lists and formulae that I want to keep consistent. The other is called 'Template' and contains an unpopulated version of the populated columns in the Plan sheet but with the lists and formulae in.

    I am after a macro that will copy the unpopulated 'Template' row formulae, lists and all and paste it into the 'Plan' sheet. However, I want to be able to specify how many rows to paste and at what row number location.

    I am guessing this will require a lookup to a numeric value in 2 different cells so the macro knows how many rows to paste and at what row number location.

    I tried to attach an example of what I'm referring to but I could not, instead I have stored the example in google docs here:

    https://docs.google.com/spreadsheets...gid=1456821257

    Please let me know if any further information is required.

    Really appreciate any help on this!

    Cheers,

    Chris

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to insert a variable number of rows into a variable location

    Hello TheClaw2323,

    You should have made the file public and not required permission for access.

    If your workbook contains sensitive or confidential information, please change or redact that information before you post.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-06-2015
    Location
    Newcastle, England
    MS-Off Ver
    2013
    Posts
    26

    Re: Macro to insert a variable number of rows into a variable location

    Hi Leith,

    Apologies, you should be able to access it via the link below. The data has been redacted.

    https://docs.google.com/spreadsheets...it?usp=sharing

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to insert a variable number of rows into a variable location

    Hello Chris,

    You almost got lost in emails. Over the past few days I have gotten over 200. Takes me awhile to check them all.

    Thanks for posting the shared version. I am still not clear about what you are doing. Can you provide an examples (before and after) of the data and formulae?

  5. #5
    Registered User
    Join Date
    03-06-2015
    Location
    Newcastle, England
    MS-Off Ver
    2013
    Posts
    26

    Re: Macro to insert a variable number of rows into a variable location

    Hi Leith,

    Well thanks for following up

    I have managed to attach the file now with the macro I already have in place.

    The macro currently inserts new 'template' lines into the plan sheet at row 9. I basically just want to see if there's a way to specify how many of these 'template' lines to insert and at what specific row number without having to change the macro code itself.

    I'm thinking it will require a lookup to 2 different cells, one with the number of rows to insert and one with the row number location to insert the cells at, although I don't have the VBA skills to know if this is possible.

    I hope that clears it up a bit? Please let me know if not.

    Cheers,

    ChrisExcel Example.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. [SOLVED] Macro code to insert 3 rows on spreadsheet with variable number of rows
    By D18GE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 07:33 AM
  2. Replies: 6
    Last Post: 04-14-2012, 04:07 AM
  3. Insert Row at Variable Location
    By agentred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2009, 12:35 AM
  4. Need to insert formula to a variable number of rows
    By edoc abv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2005, 12:05 AM
  5. insert variable number of rows
    By tina in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2005, 10:06 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