Automatic copy selection and paste in another sheet / cell

livetolearn4life

New Member
Joined
Jul 14, 2020
Messages
15
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
Hello, don't know what is going on here.. I want to copy a value in any cell clicked on in column D on one sheet and automatic paste that value only in cell A1 of the "Dashboard" sheet.. not sure if it is a problem or not, but column A1 in the "Dashboard" sheet is set a drop down list... But the issue is im getting the 1004 run time error at the "Range("A1").Select line below.


Sub Worksheet_SelectionChange(ByVal Target As Range) 'single click version


If Intersect(Target, Range("D:D")) Is Nothing Then
Application.CutCopyMode = False 'clears clipboard and stops cell flashing - like pushing escape key
Exit Sub
Else
ActiveCell.Copy
End If

If Target.Column <> 4 Then Exit Sub

Sheets("DASHBOARD").Select
Range("A1").Select
Selection.PasteSpecial PASTE:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
How about
VBA Code:
Sub Worksheet_SelectionChange(ByVal Target As Range) 'single click version


If Intersect(Target, Range("D:D")) Is Nothing Then
Application.CutCopyMode = False 'clears clipboard and stops cell flashing - like pushing escape key
Exit Sub
End If

If Target.Column <> 4 Then Exit Sub

Sheets("results").Range("A1").Value = Target.Value

End Sub
 
Upvote 0
Solution
How about
VBA Code:
Sub Worksheet_SelectionChange(ByVal Target As Range) 'single click version


If Intersect(Target, Range("D:D")) Is Nothing Then
Application.CutCopyMode = False 'clears clipboard and stops cell flashing - like pushing escape key
Exit Sub
End If

If Target.Column <> 4 Then Exit Sub

Sheets("results").Range("A1").Value = Target.Value

End Sub
that did the trick! thanks a million mate!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

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