Avatar billede Nuser2008 Mester
08. juni 2021 - 07:28 Der er 3 kommentarer og
1 løsning

Select specific value in data validation list

Hi Forum,

I would like to run a makro that selects a specific value in a data validation list.

The position where the drop down list is to be found is on Sheet1, range E5.

The values in the list are to be found on Sheet2, range A1 to A3:
A1: Klik
A2: DepotAuM
A3: TotalAuM

I would like the selected value to be Klik when running the makro.

I hope you can help me with this little issue. Thanks in advance.

Kr., Arne
Avatar billede kim1a Ekspert
08. juni 2021 - 08:21 #1
Perhaps something like this - I expect "Klik" to be a valid item in your validation list:
sheet1.range("E5").value = sheetx.range("A1").value
Avatar billede Nuser2008 Mester
08. juni 2021 - 08:47 #2
Hi Kim

Thanks for your very quick reply!

With this code: sheet1.range("E5").value = sheet2.range("A1").value

... I get this error message: Object required (Run-time error '424').

sheet1.range("E5").value is the position with the drop down from the data validation list.

Can you help me here?
Avatar billede kim1a Ekspert
08. juni 2021 - 09:49 #3
Ah, wait - I'm an idiot, sorry:
sheets(1).range("E5").value = sheets(2).range("A1").value
You can replace (1) with the sheet name in "" if you prefer, as the sheets might have a different numbering when using sheets(1) than what you expect.
Avatar billede Nuser2008 Mester
08. juni 2021 - 10:28 #4
Great! Thanks! A little detail, big impact!

Have a nice day. You saved mine :-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester