Automatically transfer data into a cell with a single mouse click

  • Thread starter Thread starter JBJ
  • Start date Start date
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
 
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
 
Back
Top