Change cell value when selection made from drop list in another ce

B

bobdpirate

Please help me someone. I'm new at VBA but I know VB. I have several cells
with drop down lists. For example, column D rows 1-5 have drop down lists
associated with them. When I click on the cell, the list pops up and I
select a value. When that happens, I want to search for the selected text in
column C. I then want to copy the values of columns C and D in the row where
the text was found and paste those values in column E and F on the row where
the drop down list was activated. I know this sounds complicated, and I hate
to ask for someone else to write code for me. But this is a one time job
that I need to do and I don't have time to become well versed in VB for
Excell. I would appreciate the help. I am a Labview expert and I often help
and write small code for other beginners in the Labview forum. So I guess
I'm doing my part in one language and would like help in another language in
return.
 
P

Per Jessen

Hi Bob D Pirate

As this code is an event code it has to go into the code sheet for the
desired worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
Set isect = Intersect(Target, Range("D1:D5")) ' Change range as
desired
If Not isect Is Nothing Then
sText = Target.Value
If sText = "" Then End
Set f = Columns("C").Find(what:=sText, lookat:=xlWhole)
If f Is Nothing Then
msg = MsgBox("No match")
Else
Range(f).Resize(1, 2).Copy f.Offset(0, 1)
End If
End If
End Sub

Best regards,
Per
 

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

Top