Drop down list to drop with cell selection.

litlwillie

New Member
Joined
Jan 16, 2008
Messages
42
I have a spreadsheet with drop down lists in 2 different cells. I would like for the list to drop down when the cell is selected. If I can get this to work I have additional lists I'd like to create. I have some knowledge of programming with VBA and this seems to be the kind of thing that could be done in VBA. Thanks in advance I've always found users here to be very knowledgable.
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thanks Andrew,
The lists work fine right now. I'm just trying to keep from having to click twice once to activate the list and then on the arrow to drop the list. I don't think you can do that with Data Validation alone.
 
Upvote 0
You might try something like this. The SendKeys as written will probably have to be changed to the correct Windows key combination.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If Target.Cells.Count = 1 Then
        On Error Resume Next
        With ActiveCell.Validation
            If Not (.Type = 3 And .InCellDropdown) Then
                Rem not list validation
            Else
                On Error GoTo 0
                If Application.OperatingSystem Like "*Macintosh*" Then
                    On Error Resume Next
                    MacScript ("tell application ""System Events"" " & vbCr & _
                     "tell process ""Microsoft Excel"" " & vbCr & _
                     "keystroke ASCII character 31 using option down" & vbCr & _
                     "end tell" & vbCr & _
                     "end tell")
                     On Error GoTo 0
                Else
                    Application.SendKeys ("#{DOWN}")
                End If
            End If
            On Error GoTo 0
        End With
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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