Automatically transfer data into a cell with a single mouse click

J

JBJ

I have a list of location names in A2:A30, and I want to
simply click on one of these locations and automatically
fill D2 with this name.
How do I do this
Thanks
 
B

Bernie Deitrick

JBJ,

Right click on the sheet tab, select "View Code" and then paste the
sub below into the window that appears.

HTH,
Bernie

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count <> 1 Then Exit Sub
If Not Intersect(Range("A2:A30"), Target) Is Nothing Then
Range("D2").Value = Target.Value
End If
End Sub
 

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