![]() |
offset copy
Have the following code do not fully understand the parts. It works but I am
trying to only copy & paste part of the data. Data is in columns 'A' thru 'H'. I wish to copy 'A' thru 'E'. Have hit a brain dead spot. If someone can define or set this code I think then I can get it. Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target |
offset copy
Since you didn't include all code, it's hard to tell what you want. Maybe
this helps? It will copy columns a-e for the target row. Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("a2:a22")) Is Nothing Then Target.Resize(, 5).Copy End If End Sub -- Don Guillett SalesAid Software "Curt" wrote in message ... Have the following code do not fully understand the parts. It works but I am trying to only copy & paste part of the data. Data is in columns 'A' thru 'H'. I wish to copy 'A' thru 'E'. Have hit a brain dead spot. If someone can define or set this code I think then I can get it. Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target |
offset copy
Here is full code Your approch is different to me have not approached from
this way seems you approach uses less code Thanks for responce Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo errhandler Application.EnableEvents = False If Target.Column = 8 And Target.Value <= 0 And IsNumeric(Target.Value) Then _ Call CopyMailc(Target) Application.EnableEvents = True Exit Sub errhandler: Application.EnableEvents = True End Sub Public Sub CopyMailc(ByVal Target As Range) Dim wksSummary As Worksheet Dim rngPaste As Range Set wksSummary = Sheets("Mailc") Set rngPaste = wksSummary.Cells(65536, "A").End(xlUp).Offset(1, 0) ' recommend disabling events to block extra passes through ' Worksheet_Change caused by changing Donors cells Application.EnableEvents = False ' option 2, next row down for demo purposes Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target Application.EnableEvents = True End Sub "Don Guillett" wrote: Since you didn't include all code, it's hard to tell what you want. Maybe this helps? It will copy columns a-e for the target row. Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("a2:a22")) Is Nothing Then Target.Resize(, 5).Copy End If End Sub -- Don Guillett SalesAid Software "Curt" wrote in message ... Have the following code do not fully understand the parts. It works but I am trying to only copy & paste part of the data. Data is in columns 'A' thru 'H'. I wish to copy 'A' thru 'E'. Have hit a brain dead spot. If someone can define or set this code I think then I can get it. Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target |
offset copy
Public Sub CopyMailc(ByVal Target As Range)
Dim wksSummary As Worksheet Dim rngPaste As Range Set wksSummary = Sheets("Mailc") Set rngPaste = wksSummary.Cells(65536, "A").End(xlUp).Offset(1, 0) ' recommend disabling events to block extra passes through ' Worksheet_Change caused by changing Donors cells Application.EnableEvents = False ' option 2, next row down for demo purposes Target.Parent.Cells(Target.row, 1).Resize(1,5).Copy _ Destination:=rngPaste Application.EnableEvents = True End Sub do nothing statements were removed. -- Regards, Tom Ogilvy "Curt" wrote: Here is full code Your approch is different to me have not approached from this way seems you approach uses less code Thanks for responce Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo errhandler Application.EnableEvents = False If Target.Column = 8 And Target.Value <= 0 And IsNumeric(Target.Value) Then _ Call CopyMailc(Target) Application.EnableEvents = True Exit Sub errhandler: Application.EnableEvents = True End Sub Public Sub CopyMailc(ByVal Target As Range) Dim wksSummary As Worksheet Dim rngPaste As Range Set wksSummary = Sheets("Mailc") Set rngPaste = wksSummary.Cells(65536, "A").End(xlUp).Offset(1, 0) ' recommend disabling events to block extra passes through ' Worksheet_Change caused by changing Donors cells Application.EnableEvents = False ' option 2, next row down for demo purposes Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target Application.EnableEvents = True End Sub "Don Guillett" wrote: Since you didn't include all code, it's hard to tell what you want. Maybe this helps? It will copy columns a-e for the target row. Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("a2:a22")) Is Nothing Then Target.Resize(, 5).Copy End If End Sub -- Don Guillett SalesAid Software "Curt" wrote in message ... Have the following code do not fully understand the parts. It works but I am trying to only copy & paste part of the data. Data is in columns 'A' thru 'H'. I wish to copy 'A' thru 'E'. Have hit a brain dead spot. If someone can define or set this code I think then I can get it. Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target |
offset copy
Thanks so much sure takes someone smarter on this than I am. Knowung a few
words sure helps Thanks Again "Tom Ogilvy" wrote: Public Sub CopyMailc(ByVal Target As Range) Dim wksSummary As Worksheet Dim rngPaste As Range Set wksSummary = Sheets("Mailc") Set rngPaste = wksSummary.Cells(65536, "A").End(xlUp).Offset(1, 0) ' recommend disabling events to block extra passes through ' Worksheet_Change caused by changing Donors cells Application.EnableEvents = False ' option 2, next row down for demo purposes Target.Parent.Cells(Target.row, 1).Resize(1,5).Copy _ Destination:=rngPaste Application.EnableEvents = True End Sub do nothing statements were removed. -- Regards, Tom Ogilvy "Curt" wrote: Here is full code Your approch is different to me have not approached from this way seems you approach uses less code Thanks for responce Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo errhandler Application.EnableEvents = False If Target.Column = 8 And Target.Value <= 0 And IsNumeric(Target.Value) Then _ Call CopyMailc(Target) Application.EnableEvents = True Exit Sub errhandler: Application.EnableEvents = True End Sub Public Sub CopyMailc(ByVal Target As Range) Dim wksSummary As Worksheet Dim rngPaste As Range Set wksSummary = Sheets("Mailc") Set rngPaste = wksSummary.Cells(65536, "A").End(xlUp).Offset(1, 0) ' recommend disabling events to block extra passes through ' Worksheet_Change caused by changing Donors cells Application.EnableEvents = False ' option 2, next row down for demo purposes Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target Application.EnableEvents = True End Sub "Don Guillett" wrote: Since you didn't include all code, it's hard to tell what you want. Maybe this helps? It will copy columns a-e for the target row. Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("a2:a22")) Is Nothing Then Target.Resize(, 5).Copy End If End Sub -- Don Guillett SalesAid Software "Curt" wrote in message ... Have the following code do not fully understand the parts. It works but I am trying to only copy & paste part of the data. Data is in columns 'A' thru 'H'. I wish to copy 'A' thru 'E'. Have hit a brain dead spot. If someone can define or set this code I think then I can get it. Set rngPaste = rngPaste.Offset(0, 0) Range(Target.Offset(0, -7), Target.Offset(0, -7)).Copy _ Destination:=rngPaste rngPaste.Offset(0, 7) = Target |
All times are GMT +1. The time now is 07:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com