Actions triggered by selection in a dropdown menu?

Grek

Board Regular
Joined
May 9, 2004
Messages
90
Hello,
I'm working on a global excel matrix for a project.
On cells in column 1 I want to have a dropdown menu with 2-3 choices (ie. "Full Structure", "Half Structure", "Light Structure", etc.
Then, if I select "full structure", I want all the cells on the same row to be available for update, if I select "half structure", I want the cells in column C,E and G to be populated with N/A automatically, etc for each line
How could I do that?
Many thanks,
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Use Data Validation in Column 1 to restrict choices to those you indicated.
Use the following code in the worksheet codepage.
Adjust the range below to cover the data validation range.
Select the method you want to use to fill in the N/A values. One will add the N/A values and leave the other cells alone, the other will the specified value in all cells cells.
The second number in the .Resize(1, 6) method is determined by the number of elements in the array that follows.

Rich (BB code):
Option Explicit
 
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A1:A20")) Is Nothing Then
        Application.EnableEvents = False
 
        Select Case Target.Value
        Case "Full"
           Target.Offset(0, 1).Resize(1, 6) = Array("", "", "", "", "", "") 'Blanks all cells
        Case "Half"
            'If you want the other cells to be blanked out, use this method:
            Target.Offset(0, 1).Resize(1, 6).Value = Array("", "N/A", "", "N/A", "", "N/A")
        Case "Light"
            'If you want cells not mentioned below to retain their current values, use this method"
           Target.Offset(0, 2) = "N/A" 'C
           Target.Offset(0, 4) = "N/A" 'E
           Target.Offset(0, 6) = "N/A" 'G
        Case ""
            Target.Offset(0, 1).Resize(1, 6).Value = Array("", "", "", "", "", "")
        Case Else
            MsgBox "Error: Unplanned response in " & Target.Address
        End Select
 
        Application.EnableEvents = True
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,570
Messages
6,179,610
Members
452,931
Latest member
The Monk

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