Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default DoubleClick worksheet macro to copy paste cell value to another sheet


Hi. I've got a macro the copies the value in whatever cell (varies)
when it is double clicked to another cell on another sheet (static,
E2). I recorded a macro without selecting the cell first (just
recorded the copy and paste to the specific cell). Afterwords, I made
a BeforeDoubleClick worksheet module. If I run this code as a regular
Sub macro, it works just fine. But when I try to run it as a
worksheet BeforeDoubleClick macro, I get a run-time error that says,
'Run-time error 1004: Select method of Range class failed.' The code
is below, and it fails at the Range("E2").Select line. I tried
Range("E2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False, but that also failed.

I Googled this and found that others have done this successfully, so
what is going wrong here with mine? Thanks for any insights.


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Application.CutCopyMode = False
Selection.Copy
Sheets("InvestigatorPro").Select
Range("E2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default DoubleClick worksheet macro to copy paste cell value to anothersheet

hi,

if you want to copy only the value and not the format

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Sheets("InvestigatorPro").Range("E2") = Target.Value
End Sub


isabelle

Le 2015-05-11 21:00, Phrank a écrit :

Hi. I've got a macro the copies the value in whatever cell (varies)
when it is double clicked to another cell on another sheet (static,
E2). I recorded a macro without selecting the cell first (just
recorded the copy and paste to the specific cell). Afterwords, I made
a BeforeDoubleClick worksheet module. If I run this code as a regular
Sub macro, it works just fine. But when I try to run it as a
worksheet BeforeDoubleClick macro, I get a run-time error that says,
'Run-time error 1004: Select method of Range class failed.' The code
is below, and it fails at the Range("E2").Select line. I tried
Range("E2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False, but that also failed.

I Googled this and found that others have done this successfully, so
what is going wrong here with mine? Thanks for any insights.


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Application.CutCopyMode = False
Selection.Copy
Sheets("InvestigatorPro").Select
Range("E2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to copy data and paste to a new sheet in next available cell Neil[_29_] Excel Programming 2 September 25th 09 12:51 AM
Help to code Macro to Copy fron one sheet and paste in other sheet kay Excel Programming 3 July 25th 08 06:46 PM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro help - copy row, clear, and paste on different sheet miker1999[_3_] Excel Programming 3 February 1st 04 03:22 AM


All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"