Need Assist with Autocopy code

jesse lee

New Member
Joined
Sep 18, 2004
Messages
23
I have 15 ranges in a worksheet that I need to track for changes, if the valuse changes to a value greater than zero, then I want to copy that row to "Sheet1". I can get the first range to work, but the subsequent ranges do not...
See Code Below...

Any assistance would be greatly appreciated...

Thank You

Jesse Lee

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng1 As Range
Dim LastRow As Object

' Set your Copy To range here
Set LastRow = Sheets("Sheet1").Range("A1342").End(xlUp)

' Only look at single cell changes
If Target.Count < 1 Then Exit Sub

' Set your change range here
Set rng1 = Range("C4:C9, C17:C21, C38:C32, I38:I48, F54:F64, C70:C1, C94:C97, C103:C106, C112:C116, C120:C122, C127:C130, D136:D145, I152:I161, I166:I172, F177F180")

' Only look at that range
If Intersect(Target, rng1) Is Nothing Then Exit Sub

' Set your condition here
If Target > 0 Then Target.EntireRow.Copy LastRow.Offset(1, 0)

End Sub
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Jesse,

There is a typo in your code
Target.Count < 1
Should be >

kind regards,
Erik
 

jesse lee

New Member
Joined
Sep 18, 2004
Messages
23
Thanks for the response... I fixed the typo, but I am only getting the first range, changes in the remaining ranges are not being copied...

Thanks again.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Jesse,

Your code says:
When one single cells of the range (in which I suspect another typo C70:C1 and also error F177F180) is changed the entirerow is copied to the next row in sheet1.That's exactly what your code is doing BUT if you don't have data in column A of your "source"sheet it will paste next time on the same row of sheet1 ...
I can get the first range to work, but the subsequent ranges do not...
can you elaborate a bit this problem
Plaese give an example of what you're doing and what you expect to happen.

kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,122,705
Messages
5,597,668
Members
414,162
Latest member
jborjal1967

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top