+ Reply to Thread
Results 1 to 10 of 10

Adding Rows to different areas on a worksheet

  1. #1
    Registered User
    Join Date
    11-13-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    17

    Adding Rows to different areas on a worksheet

    I'm not to knowledgeable on the use of VBA coding yet and usually get my help from searching online forums like this to push myself to an eventual solution, but I'm having no luck on this one.

    My issue is that I need to have a macro to add rows to a specific area on a worksheet that looks like this (There are multiple "Scopes"):
    Scoping.PNG

    I currently have a macro to add and deleted rows from Scope Group 1, which are assigned to the named buttons

    Add
    Please Login or Register  to view this content.
    Delete
    Please Login or Register  to view this content.
    But I'm having an issue of doing a similar thing to Scope Group 2, 3, 4 etc., as when a row is added to Scope Group 1, the starting selected row will have moved either up or down.

    I'm hoping to get help coming up with a dynamic function so that when a button on Scope Group 2 will add/delete a row in 2 and so on for Group 3, 4 etc.
    Attached Files Attached Files
    Last edited by kinakin; 11-13-2019 at 11:21 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,444

    Re: Adding Rows to different areas on a worksheet

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, 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

    I did it for you this time. Please read forum rules. Thanks

  3. #3
    Registered User
    Join Date
    11-13-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    17

    Re: Adding Rows to different areas on a worksheet

    Sorry about that! I really appreciate the guidance.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding Rows to different areas on a worksheet

    Use the row location of each button-shape to add\delete a row below the button.

    You could assign these same macros to each Scope Group of buttons as long as each button has a unique name.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Registered User
    Join Date
    11-13-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    17

    Re: Adding Rows to different areas on a worksheet

    Thanks so much! The code works as it should, allowing me to add lines dependent on where the buttons are, but I'm having an issue now with the fill command I had, as I get the line added above line 1 in the particular Scope Group, but it does not copy the formatting of the line below it
    Scope Grouping.PNG

    This is the code that I use now as well

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kinakin; 11-13-2019 at 02:33 PM. Reason: spelling

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding Rows to different areas on a worksheet

    I don't know what you want. Do you want A6 to fill with 0? Do you want to renumber A6:A15 from 1 to 10? Are you asking about borders?

  7. #7
    Registered User
    Join Date
    11-13-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    17

    Re: Adding Rows to different areas on a worksheet

    Sorry, I'll try to be more clear. Basically I want the function of the Fill Handle if I were to select A7:I7 and drag it up to A6:I6, but that can be used between the Scope Groups

    I want the borders of the new row that's been made, A6:I6 in the case of my above picture, to be the same as the row below it, A7:I7.

    I also want A6 in this case to be filled with the same formula that's in A7
    Please Login or Register  to view this content.
    So that I could continue the number count for whatever was above it, but always starting at zero.

    I hope this makes sense, as I'm not very word savvy in this kind of thing.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding Rows to different areas on a worksheet

    That made perfect sense. You're plenty word savvy. There are only about eight words (plus their variations) that have a double-v, and you used one one them. That makes you word savvy. But I digress...

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-13-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    17

    Re: Adding Rows to different areas on a worksheet

    That is exactly what I needed! Thank you so much for the help.

  10. #10
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,444

    Re: Adding Rows to different areas on a worksheet

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Replies: 3
    Last Post: 04-08-2017, 06:59 AM
  2. Deleting rows in protected worksheet, then adding new rows
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2016, 05:50 PM
  3. Adding/multiplying all combinations of numbers from 2 areas
    By MarcoPonte in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2015, 05:56 AM
  4. Adding non contiguous rows of data to an array by means of areas
    By tv69 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2014, 12:41 PM
  5. [SOLVED] Count rows between two areas in a collection/selection of multiple areas
    By JTwrk in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-02-2012, 10:38 AM
  6. adding values in user created areas, defining boarders
    By bmccarthy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2010, 10:51 AM
  7. Adding Rows to a worksheet
    By Barking_Mad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-22-2010, 09:24 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