Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Excel 2007
I have a workbook with 2 Sheets: Sheet1 and Sheet2 Sheet1 contains a list of all 50 states in column A Goal: When any item in the cell in the list of 50 states is clicked on Sheet 1, Cell A1 on Sheet2 will be populated with the contents of the cell that is clicked. Any suggestions? Thanks in advance |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
Try this code into sheet1 in the VBA window: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Sheets("Sheet2").Range("A1") = ActiveCell End Sub Regards - Dave. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave, thanks for this reply. The code works quite well.
I would like to enhance it as follows: 1. Is there a way to limit this to just column A? So if I click somewhere in column B Sheet2!A1 does not change 2. Limit it to only a double click 3. After clicking, it will jump to cell A1 on Sheet2 Thanks again "Dave" wrote: Hi, Try this code into sheet1 in the VBA window: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Sheets("Sheet2").Range("A1") = ActiveCell End Sub Regards - Dave. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Scott,
Try this Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If ActiveCell.Column = 1 Then Sheets("Sheet2").Range("A1") = ActiveCell Sheets("Sheet2").Select End If End Sub You may have to unwrap the first line if it gets wrapped by this window. Regards - Dave |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Dave. It worked out perfect.
"Dave" wrote: Hi Scott, Try this Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If ActiveCell.Column = 1 Then Sheets("Sheet2").Range("A1") = ActiveCell Sheets("Sheet2").Select End If End Sub You may have to unwrap the first line if it gets wrapped by this window. Regards - Dave |
#6
![]() |
|||
|
|||
![]()
How do you use this macro? just copy this to Visual basic?
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy and Paste using macro | Excel Discussion (Misc queries) | |||
How to write a simple copy-paste macro? | New Users to Excel | |||
HELP with macro for copy and paste | Excel Discussion (Misc queries) | |||
How to restore right click functionality for copy and paste? | Excel Discussion (Misc queries) |