ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB to dsiplay value from drop down list (https://www.excelbanter.com/excel-programming/369016-vbulletin-dsiplay-value-drop-down-list.html)

Ray :-)

VB to dsiplay value from drop down list
 
Hi, is there a way to use code to display the value selected from the
drop down list directly on a specific cell? I originally used the
vlookup function and it worked well. However, I have added the
following code to my two related drop down and the vlookup function for
matching the value of drop down 2 is no longer working. Could anyone
please help me out? If VB code is required, where should I put it?
Thanks in advance.


Option Explicit
Sub ddMstr()

Dim dd As DropDown
Dim dd1 As DropDown

Set dd = ActiveSheet.DropDowns(Application.Caller)

With dd
If .ListIndex 0 Then
Set dd1 = ActiveSheet.DropDowns("drop down 2")
dd1.ListFillRange = Worksheets("sheet2").Range("list" _
& dd.ListIndex).Address(external:=True)
dd1.ListIndex = 0
End If
End With
End Sub


Sub ddSub()
Dim dd As DropDown
Set dd = ActiveSheet.DropDowns(Application.Caller)

With dd
If .ListIndex 0 Then
End If
End With
End Sub



All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com