+ Reply to Thread
Results 1 to 7 of 7

Control Button Macro to Expand a Cell and Add New Rows

  1. #1
    Registered User
    Join Date
    10-17-2022
    Location
    England
    MS-Off Ver
    2016
    Posts
    6

    Question Control Button Macro to Expand a Cell and Add New Rows

    Hi All,

    In Table 1. I have a lot of duplicate data. I would like to be able to insert a control button with a macro that adds rows onto Course Name, Start Date and End Date and expands Name, Staff No. and Staff Group each time Joe Bloggs completes a new course.

    Table 2. is the desired outcome which I completed by merging.

    Can you help me with the VBA code to branch one cell into multiple cells that are all linked.

    Any help is greatly appreciated.

    D.
    Attached Images Attached Images
    Last edited by Data2022; 10-17-2022 at 11:05 AM.

  2. #2
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Control Button Macro to Expand a Cell and Add New Rows

    Hi Data2022. Welcome.

    Why not configure a pivot table to summarize based on table 1 that has the new course data and values in it?? A refresh or table 2 should populate with the new courses.
    Pete

  3. #3
    Registered User
    Join Date
    10-17-2022
    Location
    England
    MS-Off Ver
    2016
    Posts
    6

    Re: Control Button Macro to Expand a Cell and Add New Rows

    Hi Pete

    Thank you for the welcome and your response.

    The spreadsheet will be a working document capturing 18+ courses for 100+ staff members as they complete courses throughout the year.
    For ease of recording, to keep course and staff information aligned and to avoid duplication.
    I was hoping to add control buttons with macros attached to add new course, undo and delete as shown in the image attached.
    I have a limited knowledge of VBA.

    Thanks for your help.

    D.
    Attached Images Attached Images

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Control Button Macro to Expand a Cell and Add New Rows

    Better than merging cells would be to set Conditional Formatting to mask the duplicate Name/Staff No.

    Putting a CF formula like =(A1=A2) on cell A2 (and downward) to make the letter font white (or my preferenced light grey) would hide the duplicates and avoid the problems that merged cells create.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    10-17-2022
    Location
    England
    MS-Off Ver
    2016
    Posts
    6
    Quote Originally Posted by mikerickson View Post
    Better than merging cells would be to set Conditional Formatting to mask the duplicate Name/Staff No.

    Putting a CF formula like =(A1=A2) on cell A2 (and downward) to make the letter font white (or my preferenced light grey) would hide the duplicates and avoid the problems that merged cells create.
    Hi Mick

    Thanks for the response I would like to set up this feature for users to input data. Rather than cleaning it afterwards to remove duplicates. That way if a user is recording courses for 100 staff they only have to enter their name once along with their staff no and staff grouping. Otherwise they would have to repeat this information for each course.

  6. #6
    Registered User
    Join Date
    10-17-2022
    Location
    England
    MS-Off Ver
    2016
    Posts
    6

    Question Control Button Macro to Expand a Cell and Add New Rows

    Hi All

    This is my first time using the forum this week. Can anyone help with replicating the control buttons used in the second image - a new row is added by selecting an active cell and then clicking the new control button.

    I would like to replicate this in the first image by expanding Column A, B and C rows and adding new linked rows to Columns D,E,F and G so that name, staff number and staff group do not have to be duplicated. In other words each time Joe Bloggs completes a new course I could select the last inserted course and an add course button. The name, staff number and staff grouping would then expand accordingly and a new linked row would be created. Note conditional formatting and drop down cells are applied to some of the columns.

    This file will be an active working document for the user I wont be cleaning it by merging afterwards.

    Thank for your help in advance.
    Attached Images Attached Images

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,203

    Re: Control Button Macro to Expand a Cell and Add New Rows

    Please do NOT open duplicate threads here (please have a read of the rules you agreed to).

    If you need to add clarification, you must do so in the original thread.

    I've copied your post from the duplicate thread across for you.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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: 1
    Last Post: 02-27-2017, 09:17 AM
  2. ActiveX Control Spin Button Copy Button and Change Cell reference?
    By chrstphrbllngs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2016, 04:01 PM
  3. Replies: 3
    Last Post: 01-07-2015, 12:19 PM
  4. [SOLVED] Using macro to create a Form Control Button and Assign macro to it in a specified Cell
    By weige1989 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2014, 11:51 AM
  5. Replies: 5
    Last Post: 05-04-2013, 01:42 PM
  6. ActveX Control Button Not Working But Form Control Button is
    By MikeTruth in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2012, 05:04 AM
  7. Macro for button control
    By NickJW in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-03-2010, 01:09 PM

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