ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   application/object defined error (https://www.excelbanter.com/excel-programming/296583-application-object-defined-error.html)

rudekid

application/object defined error
 
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

--
Message posted from http://www.ExcelForum.com


rudekid[_2_]

application/object defined error
 
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

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com