display text depending on coice from drop down list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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 A
 
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:
 
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 said:
I got the script to work, I had to activate macros lol, thx m8!!!!!
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top