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
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,315
Members
448,564
Latest member
ED38

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
Back
Top