section of cells that grow when a button is pressed

Alan-1951

New Member
Joined
Nov 21, 2012
Messages
20
Office Version
  1. 365
Greetings All

I have been trying to find a way to make this happen
When the + is pressed everything inside the red is duplicated below ( with B 10 as the top corner ( C 6 / H6 / m6 contain drop down lists )
This would need to happen every time the + is pressed
It would be nice if everything in the red box could be deleted but that is properly a big ask

Filter rules.png
 
Greetings All

I have been trying to find a way to make this happen
When the + is pressed everything inside the red is duplicated below ( with B 10 as the top corner ( C 6 / H6 / m6 contain drop down lists )
This would need to happen every time the + is pressed
It would be nice if everything in the red box could be deleted but that is properly a big ask

View attachment 123787
What version of excel are you using? Could you please update your profile with the version.

Are the drop down lists is C 6 / H6 / m6 actually validation lists and if so where do they get their data from?

Can you please post a mini-sheet using XL2BB so that we can see what data is where and where the merged cells are?
 
Upvote 0
Microsoft® Excel® for Microsoft 365 MSO (Version 2502 Build 16.0.18526.20168) 64-bit
The data for the dropdown list is located on a second page called ( Dropdown Items )

Email Filters ( Blank ).xlsx
ABCDEFGHIJKLMNOPQR
1
2FILTER NAME
3
4
5RULES
6Select From DropdownSelect From DropdownSelect-+
7
8
9
10
11
12ACTIONS
13-+
14
15/INBOX
16
17
18
Work Sheet
Cells with Data Validation
CellAllowCriteria
C6:F6List='Dropdown Items'!$A$6:$A$20
H6:K6List='Dropdown Items'!$A$22:$A$35
M6List='Dropdown Items'!$A$38:$A$40
C13:F13List='Dropdown Items'!$A$44:$A$50



Email Filters ( Blank ).xlsx
A
4
5RULES
6Select From Dropdown
7From
8Subject
9To
10Any Recipient
11Reply
12Body
13Any Header
14Has Not Been Previusly Delivered
15Is Error Message
16List
17ID
18Span Status
19Spam Bar
20Span Score
21
22Select From Dropdown
23contains
24matches regex
25does not contain
26equals
27begins with
28ends with
29does not begin
30does not end with
31does not match
32is above ( numbers only )
33is not above ( numbers only )
34is below ( numbers only )
35is not below ( numbers only )
36
37
38Select
39AND
40OR
41
42
43ACTIONS
44
45Disgard Message
46Redirect to Email
47Fail With Message
48Stop Processing Rules
49Deliver to Folder
50Pipe to a Program
51
Dropdown Items
 
Upvote 0
How i would envisage it working that when the + box is pushed in the red box ( RULES ) a second block is added and the green box ( ACTIONS ) moves down and so on.
The same with the green box ( ACTIONS ) when the + is pressed a second and so on is created

Email Filters ( Blank ).xlsx
ABCDEFGHIJKLMNOPQR
1
2FILTER NAME
3
4
5RULES
6Select From DropdownSelect From DropdownAND-+
7
8
9
10
11Select From DropdownSelect From DropdownAND-+
12
13
14
15
16ACTIONS
17-+
18
19/INBOX
20
21
Work Sheet
Cells with Data Validation
CellAllowCriteria
C6:F6List='Dropdown Items'!$A$6:$A$20
C11:F11List='Dropdown Items'!$A$6:$A$20
H6:K6List='Dropdown Items'!$A$22:$A$35
H11:K11List='Dropdown Items'!$A$22:$A$35
M6List='Dropdown Items'!$A$38:$A$40
M11List='Dropdown Items'!$A$38:$A$40
C17:F17List='Dropdown Items'!$A$44:$A$50
 
Upvote 0
How i would envisage it working that when the + box is pushed in the red box ( RULES ) a second block is added and the green box ( ACTIONS ) moves down and so on.
The same with the green box ( ACTIONS ) when the + is pressed a second and so on is created

Email Filters ( Blank ).xlsx
ABCDEFGHIJKLMNOPQR
1
2FILTER NAME
3
4
5RULES
6Select From DropdownSelect From DropdownAND-+
7
8
9
10
11Select From DropdownSelect From DropdownAND-+
12
13
14
15
16ACTIONS
17-+
18
19/INBOX
20
21
Work Sheet
Cells with Data Validation
CellAllowCriteria
C6:F6List='Dropdown Items'!$A$6:$A$20
C11:F11List='Dropdown Items'!$A$6:$A$20
H6:K6List='Dropdown Items'!$A$22:$A$35
H11:K11List='Dropdown Items'!$A$22:$A$35
M6List='Dropdown Items'!$A$38:$A$40
M11List='Dropdown Items'!$A$38:$A$40
C17:F17List='Dropdown Items'!$A$44:$A$50
Give this a go on a copy of your 'Work Sheet' worksheet in a new workbook.

This code goes in the 'Work Sheet' sheet code module.

It would be handy if you could post a mini-sheet using XL2BB containing a number of rules and actions.

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngWhat As Range
Dim strWhat As String
Dim intRow As Integer

  If Target.CountLarge > 1 Then
    Exit Sub
  End If
        
  If Target.Value = "+" Then
                
    Target.Offset(4, 0).EntireRow.Resize(5).Insert
    
    Target.Offset(0, -14).Resize(4, 16).Copy Destination:=Target.Offset(5, -14)
        
  End If
  
  If Target.Value = "-" Then
  
    Target.Offset(-1, 0).Select
  
    If Len("RULES,ACTIONS") > Len(Replace("RULES,ACTIONS", Target.Offset(-1, -12).Value, "")) Then
      MsgBox "Invalid action.", vbOKOnly, "Warning"
      Exit Sub
    End If
      
    Target.Resize(5, 1).EntireRow.Delete

  End If
  
End Sub
 
Upvote 0
Solution
Greetings All

High And Wilder : provided a most excellent solution for this question.
Went well beyond the brief in providing the solution.
I had been trying to achieve a solution for days but only came close, it never worked as expected.
Many thanks for your assistance, a real credit to Mr Excel Community
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top