ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   On click, copy text into another cell - XL2K (https://www.excelbanter.com/excel-worksheet-functions/17996-click-copy-text-into-another-cell-xl2k.html)

Bob the Builder

On click, copy text into another cell - XL2K
 
I'm trying figure out how to copy text from a "list" (i.e., 4 or 5 text
entries in one column, but each in individual cells) to another cell in the
same spreadsheet by clicking on the original cell just once. The text always
needs to copy to the same final cell, but can change. For example, cells
A1:A3 contain "A1:small, A2:medium and A3:large". Clicking on one of these
pastes it into another cell, such as D1. Each time a different cell is
clicked in A1:A3, the text in D1 changes accordingly.

Any help is greatly appreciated.

Fred

Try pasting this procedure in the appropriate worksheet object code
sheet

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 1 Then
Range("d1") = Range("a1")
ElseIf Target.Row = 4 And Target.Column = 1 Then
Range("d1") = Range("a2")
ElseIf Target.Row = 7 And Target.Column = 1 Then
Range("d1") = Range("a3")
End If
End Sub

Good luck!


Fred

Sorry, correct the target.row = 4 to 2, amd target.row = 7 to 3. Mea
culpa, bigtime!



All times are GMT +1. The time now is 07:03 PM.

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