VBA code to double click and past on three different columns

Mark1112

New Member
Joined
Nov 21, 2021
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Hi Guys,
I am novice in VBA... this is what I am trying to do:
I have 1.000 raws and four columns, on double click on each cell of the three columns E, F, G it must copy the value from the same raw of column C into the cell where I clicked.
Example: double click on G6 --> copy C6 in G6

1637500757689.png


I started to write my little VBA code but I don't know the most important command to do this..... (???????????)
(sorry for my english)

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Columns("E5:G1000")) Is Nothing Then
Cancel = True
?????????????????????
End If
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi & welcome to MrExcel.
How about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Not Intersect(Target, Range("E5:G1000")) Is Nothing Then
      Cancel = True
      Target.Value = Range("C" & Target.Row).Value
   End If
End Sub
 
Upvote 0
Solution
Hi & welcome to MrExcel.
How about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Not Intersect(Target, Range("E5:G1000")) Is Nothing Then
      Cancel = True
      Target.Value = Range("C" & Target.Row).Value
   End If
End Sub

It works perfectly... it is exactly what I need !
Thank you very much, Fluff ?
You are GREAT !
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

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