application/object defined error

R

rudekid

Does anyone know why the following code returns a "1004 error" when i
tries to paste? All the worksheets (those starting Wht) have bee
defined correctly but it seems not to recognise them?

Dim Cell As Variant

For Each Cell In WhtCode.Range("N2:N30")
If Cell.Value <> "0" Then
WhtData.Range(Cell.Value).Cut
WhtData.Range(WhtData.Cells(Row, 26)).PasteSpecia
xlValues

End If
Next Cell

I've tried using different syntax e.g. worksheets("data")...an
altering the reference Row to e.g. a number but to no avail.

Any ideas?

thank
 
R

rudekid

sorry, figured it out: Cells syntax was wrong! eek:

For the record, the correct code now reads:

Dim Cell As Variant

For Each Cell In WhtCode.Range("N2:N30")
If Cell.Value <> "0" Then
whtData.Range(Cell.Value).Cut
whtData.Range(whtData.Cells(Cell.row, 26)
whtData.Cells(Cell.row, 26)).Select
ActiveSheet.Paste

End If

Next Cel
 
Top