PDA

View Full Version : Application-defined or object-defined error



lijon
01-22-2010, 12:54 PM
Hi folks,
I inherited a macro at work. It usually runs fine, but now breaks down.
The error # and error msg box comes back as
"1004 - Application-defined or object-defined error"

I've only included the part where it breaks down since its so huge ...and I suspect its in the syntax or somethihng here.
-------------------------------------------------------------------

If CurrFile = "US" Then (it does = US)

ActiveCell.Offset(0, 8).Formula = "=RtGet(""IDN"",A" & ActiveCell.Row & ",""OFFCL_CODE"")"

ActiveCell.Offset(0, 7).Formula = "=VLOOKUP("" "" & RIGHT(I" & ActiveCell.Row & ",LEN(I" & ActiveCell.Row & ")-3),'c:\[Available.xls]Inventory'!$A:$T,4,FALSE)"
this is where it breaksdown

Else
ActiveCell.Offset(0, 8).Value = 0

-----------------------------------------------------------------
Would love some help interpreting the "1004" error msg this generates.

The size of the file this macro in and the file referenced (available.xls) have recently grown, they're both 10mb files now so I wonder if its a memory related issue as well.


thanks much!!

lijon
01-22-2010, 02:45 PM
Had another thought on this: What this piece of code does (when it works) is drop a long vlookup formula in to a cell (then repeat for a bunch of rows).
IS THERE A WAY to do the vlookup in vba and then put the resulting value in the excel cell - instead of doing the lookup in the excel cell itself.

Something like application.formula.vlookup(blah blah blah).
Does anyone know how to write vlookups IN vba???

Bob Phillips
01-22-2010, 05:55 PM
You coule do, but it would probably error in the same way. Have you checked the result of

"" "" & RIGHT(I" & ActiveCell.Row & ",LEN(I" & ActiveCell.Row & ")-3)

and see what it holds.