staticbob
Well-known Member
- Joined
- Oct 7, 2003
- Messages
- 1,079
Hi,
I have this code (from JimBoy) that I use to copy data from one sheet to another. The source data is updated weekly, I am using the code to copy the updated cells to a new sheet so I have a log of progress.
The code works, it copies some data, but not all. it also debugs on the line after next c with the error - Application or object defined error.
All I am trying to do is copy cells E6:E102 (last entry) from the sheet "Progress Report" onto the next available column in the sheet "As Built data". This will obviously build-up each week.
Any help would be much appreciated !
Bob
Dim c As Range, d As Range
Dim mycolumn As Integer
mycolumn = Sheets("As Built Data").Range("IV1").End(xlToLeft).Column + 1
Sheets("As Built data").Cells(1, mycolumn) = Sheets("Progress Report").Range("C4").Value
For Each c In Sheets("Progress Report").Range("A6:A" & Range("A65536").End(xlUp).Row)
For Each d In Sheets("As Built Data").Range("A2:A" & Range("A65536").End(xlUp).Row)
If c.Value = d.Value Then
Sheets("As Built Data").Cells(d.Row, mycolumn) = c.Offset(0, 4)
GoTo mynext
End If
Next d
mynext:
Next c
Sheets("As Built data").Range(Cells(2, mycolumn), Cells(5000, mycolumn)).NumberFormat = "0.00%"
ActiveSheet.Protect Password:="apples"
I have this code (from JimBoy) that I use to copy data from one sheet to another. The source data is updated weekly, I am using the code to copy the updated cells to a new sheet so I have a log of progress.
The code works, it copies some data, but not all. it also debugs on the line after next c with the error - Application or object defined error.
All I am trying to do is copy cells E6:E102 (last entry) from the sheet "Progress Report" onto the next available column in the sheet "As Built data". This will obviously build-up each week.
Any help would be much appreciated !
Bob
Dim c As Range, d As Range
Dim mycolumn As Integer
mycolumn = Sheets("As Built Data").Range("IV1").End(xlToLeft).Column + 1
Sheets("As Built data").Cells(1, mycolumn) = Sheets("Progress Report").Range("C4").Value
For Each c In Sheets("Progress Report").Range("A6:A" & Range("A65536").End(xlUp).Row)
For Each d In Sheets("As Built Data").Range("A2:A" & Range("A65536").End(xlUp).Row)
If c.Value = d.Value Then
Sheets("As Built Data").Cells(d.Row, mycolumn) = c.Offset(0, 4)
GoTo mynext
End If
Next d
mynext:
Next c
Sheets("As Built data").Range(Cells(2, mycolumn), Cells(5000, mycolumn)).NumberFormat = "0.00%"
ActiveSheet.Protect Password:="apples"