Help me modify this Double Click VBA

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
788
Office Version
  1. 365
Platform
  1. Windows
Hi,

i have this VBA code which if a cell in the range E8:AF10 is clicked, the cell value is copied to Sheet 2 - B3

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)If Not Intersect(Target, Range("E8:AF10")) Is Nothing Then
    Cancel = True
    Target.Copy
    Sheets("Sheet2").Range("B3").PasteSpecial Paste:=xlPasteValues
End If
End Sub

Now instead of copying the clicked cell i want it to copy 2 things:
Value in Row 6 of the current cell
example: If cell F9 is clicked > copy cell F6

Value in Column AI of the current cell
example: If F9 is clicked > copy cell AI9

Appreciate any help
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How about
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("E8:AF10")) Is Nothing Then
    Cancel = True
    Cells(6, Target.Column).Copy
    Sheets("Sheet2").Range("B3").PasteSpecial Paste:=xlPasteValues
    Range("AI" & Target.Row).Copy
    '???
End If
End Sub
 
Upvote 0
How about
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("E8:AF10")) Is Nothing Then
    Cancel = True
    Cells(6, Target.Column).Copy
    Sheets("Sheet2").Range("B3").PasteSpecial Paste:=xlPasteValues
    Range("AI" & Target.Row).Copy
    '???
End If
End Sub

thanks for the quick reply, working perfectly :)
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

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