+ Reply to Thread
Results 1 to 7 of 7

Deleting a specific grouping of cells with variable sizes

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

    Deleting a specific grouping of cells with variable sizes

    Hi everyone,

    I am looking to see if it is possible to add a macro to the attached workbook that can delete what I've called a Scope Group.

    Scope Breakdown 01.PNG

    For quick reference in the picture, what I would like to do is add a button that will delete an entire Scope Group, as well blank white line below, so it doesn't disturb the aesthetic. The issue with this is that the group can vary in size from as small as 1 line to as large as 200.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Deleting a specific grouping of cells with variable sizes

    Navigating on protected sheet is very uncomfortable.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

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

    Re: Deleting a specific grouping of cells with variable sizes

    Sorry about that. The password is 388158010. You can see these in the macros too.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Deleting a specific grouping of cells with variable sizes

    Hi kinakin,

    Try the following Macro which is included in the attached Workbook. I commented out all Sheet Protection.

    To use the Macro, Select a Brown 'Scope Group' Header Row and then Select the Delete 'Scope Group' CommandButton.

    The following code is in Ordinary Code Module ModDeleteScopeGroup:
    Please Login or Register  to view this content.
    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. Dim i as Integer). https://www.excel-easy.com/vba/examp...-explicit.html

    Lewis

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

    Re: Deleting a specific grouping of cells with variable sizes

    Hi LJMetzger

    This is a great start and does exactly what I looking for. I wonder though if there is a way to bypass the need to select the Scope title and have it reference the cell the button would be in instead, similar to how the Add Line macro works. I ask because I would like to put a Delete Scope Group button on each separate scope, similar to how the Add Line button is.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Deleting a specific grouping of cells with variable sizes

    Hi,

    Your idea fits much better with the design than my implementation. Well done.

    I deleted my CommandButton and put 'Delete' icons in Scope Groups 2,3, and 4. Clicking the 'Delete Icon' will delete that 'Scope Group'.

    See the attached file (most of the code is the same) containing the modified code below (much simpler now):
    Please Login or Register  to view this content.
    Lewis

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

    Re: Deleting a specific grouping of cells with variable sizes

    That's perfect! I really appreciate the help on this.

+ 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. Deleting specific characters in cells
    By zforzani in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2013, 12:25 PM
  2. Deleting Specific Data in Specific Cells
    By emily8134 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-18-2013, 10:51 AM
  3. VBA for deleting cells containing specific text
    By andrewzzz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-25-2013, 08:55 AM
  4. Deleting Rows with a specific value from a variable column (constant title)
    By seloni in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2011, 04:08 AM
  5. Replies: 3
    Last Post: 03-28-2011, 10:53 AM
  6. Highlighting or deleting specific cells
    By JoshD75 in forum Excel General
    Replies: 8
    Last Post: 05-16-2009, 01:54 PM
  7. Print variable page sizes
    By nsv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2006, 06:07 AM
  8. Deleting specific cells in a selected row
    By Jeff Wright in forum Excel General
    Replies: 5
    Last Post: 04-17-2005, 01:06 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