View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 55
Default Worksheet_beforedoubleclick

Hi

I wish to be advised why it failed, and how to rectify please.

Listing A was tested working as expected.
sub t()
Rows("9:9").Select
Selection.Copy
Sheets(Range("D1").Text).Select
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Sheets("CData").Select
end sub

Once this sub was transferred to Worksheet_BeforeDoubleClick, it failed with
Run-time Error "1004"
Select method of range class failed

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Rows(Target.Row).Select
Selection.Copy
Sheets(Range("D1").Text).Select
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select <<<<<<<<
ActiveSheet.Paste
Sheets("CData").Select
End Sub

Also I do not seem to be able to condense the code without using so many
"Select".
Are these restriction applicable to event handling please?

Thank you for your advice
Regards
KC