Forum Discussion
Angela2021
Apr 18, 2021Copper Contributor
Extracting data using a Dropdown list that will auto generate in another sheet.
I am very new to excel so excuse my lack of knowledge. I am trying to get information in a row to auto populate in another sheet when I select an item from a dropdown list. So, if I choose "dual" in ...
HansVogelaar
Apr 19, 2021MVP
Right-click the sheet tab of the first sheet.
Select 'View Code' from the context menu.
Copy the following code into the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim r As Long
Dim wsh As Worksheet
If Not Intersect(Range("F:F"), Target) Is Nothing Then
Application.ScreenUpdating = False
Application.EnableEvents = False
Set wsh = Worksheets("DUAl SEARCHES")
r = wsh.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For Each rng In Intersect(Range("F:F"), Target)
If rng.Value = "Dual" Then
r = r + 1
wsh.Range("A" & r).Resize(1, 3).Value = Range("A" & rng.Row).Resize(1, 3).Value
End If
Next rng
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Switch back to Excel.
Save the workbook as a macro-enabled workbook.
Make sure that you allow macros when you open it.
I have attached a version with the code.
Angela2021
Apr 19, 2021Copper Contributor
I was looking at the code and in the other workbook I am working on in the "DUAL" I made it a hyper link. On the one you worked on the "dual" drop down is not a hyperlink. I was think this as the reason it was not working for me.