Click on a Cell and Contents of cell populate another cell in another worksheet

Status
Not open for further replies.

brumby

Active Member
Joined
Apr 1, 2003
Messages
400
Hi There,

Hopefully an easy one.

I have a worksheet called "Main Sheet", I would like for any cell I click on in Col D, the contents of that cell to appear in worksheet "JOB CHECK" in Cell F1.


Appreciate you help as always!!!!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi, noob to VBA but have adjusted and used your script above which does nearly everything I need.
The additional step I need is to paste the copied cell as value as the original cell has a formula in it. This would make it perfect!
Thank you!
 
Upvote 0
I am trying something similar but have zero macro knowledge but have managed to get it to replicate a double click in column A to the last row of column A using the above macro but modified (see below). What I need is for columns A7:A30 thru E7:E30 & H7:H30 to fill A6-E6 & H6 in the respective column (same sheet - "Sheet2") which then feed a Concatenate formula that defines a file naming convention. The Concatenate works just fine, just want an easier method than drop down lists to fill the target cells. The data below is only representative and not the actual data. It will extend to line 30 when filled. Other cells are not involved in the operation I want to achieve.

ABCDEFGHIJKLMNO
1
2
3
4
5LOCATIONMFGLVL1LVL2LVL3BLDGRMUSE
6
7A1ACME10SAMAACLS
8A2JONES11ALIBBCR
9A3BROWN12MIKECCCCR
10A413BOBDDGCR
11A5NANCYEEBCR
12A6VICKYFFJOC
13TOMGGNOC
14HH
15II
16JJ
17KK
18LL
19
20
21
22
23
24
25
26
27
28
29
30

<tbody>
</tbody>

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 8/28/2018 10:57:21 AM EDT
If Not Intersect(Target, Range("A7:A30")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row + 1
Target.Copy Sheets("Sheet2").Cells(Lastrow, 1)
End If
End Sub
 
Upvote 0
Put this script in sheet named
Options
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  8/28/2018  10:57:21 AM  EDT
If Not Intersect(Target, Range("A:A")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets("List").Cells(Rows.Count, "A").End(xlUp).Row + 1
Target.Copy Sheets("List").Cells(Lastrow, 1)
End If
End Sub

I am trying to do something similar except I would like the contents from column C in Sheet 1 to populate the contents in column E starting from row 15 and on in sheet 2 when I double click an item. Also, is there a way to do something similar without Macros? Thanks.
 
Upvote 0
So this script will copy the contents of Sheet1 column C when doubled clicked on column C of sheet1
And the value will be copied to sheet2 column E starting in row 15

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet1 tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window


VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  12/6/2019  4:22:12 PM  EST
If Not Intersect(Target, Range("C:C")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets(2).Cells(Rows.Count, "E").End(xlUp).Row + 1
If Lastrow < 14 Then Lastrow = 15
Target.Copy Sheets(2).Cells(Lastrow, "E")
End If
End Sub
 
Upvote 0
I am trying to get this to work within the same sheet. I have a range of unique values in a column H. I want to be able to double click on a cell in that column and have the value copy to the last empty cell in column K. I tried editing the above script but could not get it working. Any suggestions?

000MrExcelPic.PNG
 
Upvote 0
How about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Not Intersect(Target, Range("H:H")) Is Nothing Then
      Range("K" & Rows.Count).End(xlUp).Offset(1).Value = Target
      Cancel = True
   End If
End Sub
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,992
Messages
6,122,631
Members
449,095
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top