Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Copy from ActiveRow, Paste to A2 in Another Sheet

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''.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Copy from ActiveRow, Paste to A2 in Another Sheet

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''.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Copy from ActiveRow, Paste to A2 in Another Sheet

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''.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Copy from ActiveRow, Paste to A2 in Another Sheet

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''.

  #5   Report Post  
Posted to microsoft.public.excel.programming
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''.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Copy from ActiveRow, Paste to A2 in Another Sheet

Ah! Yes! Clearly that works! I'm very tired today...
Thanks Jacob,
Ryan---

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


"Jacob Skaria" wrote:

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''.

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
Copy Paste from Class Sheet to Filtered List on Combined Sheet [email protected] Excel Programming 6 September 16th 08 04:30 PM
Help to code Macro to Copy fron one sheet and paste in other sheet kay Excel Programming 3 July 25th 08 06:46 PM
Copy from one Sheet and paste on another sheet based on condition Prem Excel Discussion (Misc queries) 2 December 24th 07 05:05 AM
Select Shape in activerow Thomp Excel Programming 2 February 16th 07 09:30 PM
automatic copy and paste from sheet to sheet in a workbook ramseyjramseyj Excel Programming 6 December 11th 04 12:37 AM


All times are GMT +1. The time now is 04:01 AM.

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

About Us

"It's about Microsoft Excel"