PDA

View Full Version : entirerow.



philfer
05-26-2010, 07:17 AM
Hello,

I am automating moving some data from access to excel.

I can get access to put information/formulae into certain cells in excel with :-

objWS.Range("data").Offset(1, 0).CopyFromRecordset rst, RcdCount, FldCount

objWS.Range("date") = ExportDate


objWS.Cells(EndRow + 3, TotalColumn).FormulaR1C1 = "=SUM(R[-" & EndRow - 1 & "]C:R[-3]C)"



but if I try to do :-

objWS.Range(Cells(EndRow + 11, 1), Cells(95, 1)).EntireRow.Select
Selection.Delete Shift:=xlUp

I get the error :-

1004 Application defined or object defined error

if I then delete the data that has been copied in the copyfromrecordset and save the workbook back down and run the proc again the line which gives me the error works just fine

I cant fathom why this is happenening

Has it happened to anyone else before

(on a different proc I try to do entirerow.insert and objWS.Range(Cells(StartRow, 1), Cells(EndRow - 1, 1)).DataSeries and the same problem happens)

Thanks
Phil

p45cal
05-26-2010, 07:37 AM
delete - someone else tidied up..

Bob Phillips
05-27-2010, 01:27 AM
Surely, it is because you are not qualifying the Cells ob ject as you do the range object.