Excel VBA - Push link and select item in dropdown list

behedwin

Active Member
Joined
Dec 10, 2014
Messages
399
Hi

I have a book with two sheets
sheet 1 and sheet2

In sheet2 i have a data validation dropdown list created based on data from sheet1

When user are in sheet1
i want the user to be able to click on a value (that is part of the dropdown list on sheet2) and then go to sheet2 and have the dropdown list load the clicked value.

So a quick way to go from sheet1 and based on what value the user clicks on, have that value selected in a the dropdown list in sheet2.

It is easy to just create a link from sheet1 to sheet2
but the problem i have is to make the action that when user click take that cells value and select that value in the dropdownlist.
 

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
To be honest i dont know...
The examples i´ve found show two dropdown lists... but only have one.

I want that if the user click on the link "Banana" in sheet1 the dropdownlist in sheet2 should set itself to Banana
And if the user click on Apple in sheet1 the dropdown list in sheet2 should be set to Apple.

In sheet1 i do not have any dropdown lists.
In sheet1 i have a list of values that are configured as links to sheet2.
So i want to add a function that when a user clicks on a link, also select the links value in the dropdownlist.
 
Upvote 0
Try Validation list in both sheets "A1":-

'Code in sheet2 module.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "A1" Then
    Sheets("Sheet1").Range("A1").Value = Target
End If
Application.EnableEvents = True
End Sub

'Code in sheet1 module.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "A1" Then
    Sheets("Sheet2").Range("A1").Value = Target
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Try Validation list in both sheets "A1":-

'Code in sheet2 module.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "A1" Then
    Sheets("Sheet1").Range("A1").Value = Target
End If
Application.EnableEvents = True
End Sub

'Code in sheet1 module.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "A1" Then
    Sheets("Sheet2").Range("A1").Value = Target
End If
Application.EnableEvents = True
End Sub


I tried this, cant get it to work.
Sheet1´s name is = skola översikt
Sheet2´s name is = enskild skola

In sheet1 i have a list of names
A4:A14
Each name are a hyperlink to sheet2 (enskild skola).

I have pasted this code in VBA editor in ÖVERSIKT SKOLA (SHEET1)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "A1" Then
    Sheets("Enskild skola").Range("A1").Value = Target
End If
Application.EnableEvents = True
End Sub

I have posted this code in VBA editor in ENSKILD SKOLA (SHEET2)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "A1" Then
    Sheets("Skola översikt").Range("A1").Value = Target
End If
Application.EnableEvents = True
End Sub


When i click on a link in SHEET1 (Översikt Skola) in range A4:A14
Nothing happens to the dropdown list in SHEET2 (Enskild Skola) A1 cell.
 
Upvote 0
My code assumes you have 2 validation lists as specified in your first thread (both with the same data) one in each sheet in cell "A1"
If you have those lists and you have pasted the code in the Worksheet modules (Right click sheet tab , Module for that sheet appears, paste code) then the codes should work.
 
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,725
Members
452,995
Latest member
isldboy

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