ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   display text depending on coice from drop down list (https://www.excelbanter.com/excel-discussion-misc-queries/90091-display-text-depending-coice-drop-down-list.html)

Calle

display text depending on coice from drop down list
 
I have made a drop down list in excel. When I click on an option I want the
text to be added to another cell, so you in that way can choose several
options from a dropdown list and have them all displayed in a cell just next
to the list.



Calle

display text depending on coice from drop down list
 
guess you can't do it... I think I overestimated excel :(

Ardus Petus

display text depending on coice from drop down list
 
This will require a Worksheet_Change event procedure in VBA (macro)

--
AP

"Calle" a écrit dans le message de news:
...
guess you can't do it... I think I overestimated excel :(




mrice

display text depending on coice from drop down list
 

Never under-estimate Excel....

If you add this sub to the sheet1 tab in the VBA editor

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target < "" Then
Cells(1, 2) = Cells(1, 2) & "," & Target
End If

End If
End Sub

this will add values into B1 from a drop down in A1


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782


Calle

display text depending on coice from drop down list
 
Hi!
It didn't work. I added this to the sheet1 tab in VBA editor and it did
nothing. I am using a drop down meny useing the validation option.


"mrice" skrev:


Never under-estimate Excel....

If you add this sub to the sheet1 tab in the VBA editor

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target < "" Then
Cells(1, 2) = Cells(1, 2) & "," & Target
End If

End If
End Sub

this will add values into B1 from a drop down in A1


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782



mrice

display text depending on coice from drop down list
 

Working spreadsheet attached


+-------------------------------------------------------------------+
|Filename: Book1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4808 |
+-------------------------------------------------------------------+

--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782


Calle

display text depending on coice from drop down list
 
Hi!
The download link doesn't work

"mrice" wrote:


Working spreadsheet attached


+-------------------------------------------------------------------+
|Filename: Book1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4808 |
+-------------------------------------------------------------------+

--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782



Calle

display text depending on coice from drop down list
 
I got the script to work, I had to activate macros lol, thx m8!!!!!

"mrice" wrote:


Working spreadsheet attached


+-------------------------------------------------------------------+
|Filename: Book1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4808 |
+-------------------------------------------------------------------+

--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782



Calle

display text depending on coice from drop down list
 
I have a new question now:
I want an option in my drop down list to clear the cell where the selected
products from the drop down list are displayed. How do I do that?

Calle

"Calle" wrote:

I got the script to work, I had to activate macros lol, thx m8!!!!!

"mrice" wrote:


Working spreadsheet attached


+-------------------------------------------------------------------+
|Filename: Book1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4808 |
+-------------------------------------------------------------------+

--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782



mrice

display text depending on coice from drop down list
 

If you change the macro to this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target < "" Then
Cells(1, 2) = Cells(1, 2) & "," & Target
End If
End If

If Target.Address = "$A$1" Then
If Application.CountIf(Range(Cells(1, 3), Cells(6, 3)), Target) 0
Then
Range(Cells(1, 3), Cells(6, 3)).Find(Target, , xlValues,
xlWhole).Clear
End If
End If
End Sub

The second segment searches for the value in a range (in this case
C1:C6) and if it finds a match clears the cell.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782


Calle

display text depending on coice from drop down list
 
Hi!
The thing is that I am using a validation/list so the source for the list is
on another worksheet. Will it still work?

"mrice" skrev:


If you change the macro to this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target < "" Then
Cells(1, 2) = Cells(1, 2) & "," & Target
End If
End If

If Target.Address = "$A$1" Then
If Application.CountIf(Range(Cells(1, 3), Cells(6, 3)), Target) 0
Then
Range(Cells(1, 3), Cells(6, 3)).Find(Target, , xlValues,
xlWhole).Clear
End If
End If
End Sub

The second segment searches for the value in a range (in this case
C1:C6) and if it finds a match clears the cell.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782



Calle

display text depending on coice from drop down list
 
I solved it. thx

"Calle" skrev:

Hi!
The thing is that I am using a validation/list so the source for the list is
on another worksheet. Will it still work?

"mrice" skrev:


If you change the macro to this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target < "" Then
Cells(1, 2) = Cells(1, 2) & "," & Target
End If
End If

If Target.Address = "$A$1" Then
If Application.CountIf(Range(Cells(1, 3), Cells(6, 3)), Target) 0
Then
Range(Cells(1, 3), Cells(6, 3)).Find(Target, , xlValues,
xlWhole).Clear
End If
End If
End Sub

The second segment searches for the value in a range (in this case
C1:C6) and if it finds a match clears the cell.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=544782




All times are GMT +1. The time now is 12:42 AM.

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