Hi,
I keep getting the above error message when pasting values. What am I doing wrong?
The exact situation is that I'm trying to copy individual rows of data from one workbook to another. The code looks at the source workbook, records each team number in the variable import_team (Dim as Double), then it looks at the target workbook and pastes the values when the team numbers match. Here is the bit of code I'm using:
For Each cell In Range("A7:A40"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
import_team = Left(cell.Value, 4)
Range(cell.Offset(0, 1), cell.Offset(0, 17)).Copy
Workbooks(model).Activate
Sheets("input"
.Select
For Each c In Range("B3:B39"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
If c.Offset(0, -1).Value = import_team Then
c.PasteSpecial xlPasteValues
Else
End If
Next c
Next cell
I have 2 questions on this:
1. why am I getting the error message? and
2. is there a better way of doing this. Since I've got nested loops I expect there is.
Thanks in advance
I keep getting the above error message when pasting values. What am I doing wrong?
The exact situation is that I'm trying to copy individual rows of data from one workbook to another. The code looks at the source workbook, records each team number in the variable import_team (Dim as Double), then it looks at the target workbook and pastes the values when the team numbers match. Here is the bit of code I'm using:
For Each cell In Range("A7:A40"
import_team = Left(cell.Value, 4)
Range(cell.Offset(0, 1), cell.Offset(0, 17)).Copy
Workbooks(model).Activate
Sheets("input"
For Each c In Range("B3:B39"
If c.Offset(0, -1).Value = import_team Then
c.PasteSpecial xlPasteValues
Else
End If
Next c
Next cell
I have 2 questions on this:
1. why am I getting the error message? and
2. is there a better way of doing this. Since I've got nested loops I expect there is.
Thanks in advance