View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Copy from ActiveRow, Paste to A2 in Another Sheet

Accidently I have marked the last line of the first macro. So unmark that
line. and in your immediate window paste that line and enter so that events
are enabled...Now try all 3 options (2 options mentioned in the 1st post)

Application.EnableEvents = True


If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

Thanks Jacob! I see that you've got the gold now!!

The first macro worked one time, but didn't work any subsequent times. The
Second macro didn't work. Seems to be something preventing it from working.
Is there some way to reset the macro. Also, I tried to clear the contents of
sheet 'Summary' row2, but now I get an error. Must be something with the
event-driven nature of the macro that I don't understand.

Working with this now:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Sheets("Summary").Select
Rows("2:2").Select ' < -- error occurs here
Selection.ClearContents
Sheets("Master").Select
Cancel = True
Application.EnableEvents = False
Rows(Target.Row).Copy
Sheets("Summary").Range("A2").PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
'OR to copy with formats
'Rows(Target.Row).Copy Sheets("Summary").Range("A2")
'Application.EnableEvents = True
End Sub

This must be an easy fix, right.

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Jacob Skaria" wrote:

If you are looking to copy only the values the below single line would do

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.EnableEvents = False
Sheets("Summary").Rows(2) = Rows(Target.Row).Value
Application.EnableEvents = True: Cancel = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

A bit confusing. Do you mean copy a single row (which is the target row) and
is sheet Master the active sheet . Then try the below. Event for master sheet

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Application.EnableEvents = False
Rows(Target.Row).Copy
Sheets("Summary").Range("A2").PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
'OR to copy with formats
'Rows(Target.Row).Copy Sheets("Summary").Range("A2")
'Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

I am trying to copy a row (could be any row) from a sheet named €˜Master and
paste to another sheet, named €˜Summary, in the same workbook, and
PasteSpecial in Cell A2.

Below is the code that I'm trying to implement:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim Currrow As Range
Currrow = Range("A2" & .Row & ":V" & .Row)
Worksheets("Master").Range("A" & Currrow & ":V" & Currrow).Copy
Worksheets("Summary").Range("A2").PasteSpecial
End Sub

It would be the entire row; doesn't matter. The data goes from A:V.

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.