View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Run-time error '1004': AutoFill method of Range class failed

I don't understand what you're doing.

But I'm gonna guess that you want to put a formula in C9:C16 and uses the value
in column A of the same row in that =vlookup() formula.

Your formula points at R3C1 ($A$3) and I'm not sure why anyone would want that
dragged down a range.

with activesheet.range("c9:c16")
.formular1c1 _
= "=VLOOKUP(RC1,'[ATF master file.xls]Orders OP'!R3C4:R55C15,2,FALSE)"
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlNone
end with

(Untested. Uncompiled. Watch for typos.)

It just plops the formula into all 8 cells in one line.



murkaboris wrote:

Hello:

I wrote a macro that recorded just fine and returned the values I needed but
when I tried to run it on the workbook and loop it for all worksheets I'm
getting the Run-time error '1004'.

Here is the excerpt from the macro:
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R3C1,'[ATF master file.xls]Orders OP'!R3C4:R55C15,2,FALSE)"
Selection.AutoFill Destination:=Range("C9:C16"), Type:=xlFillDefault
Range("C9:C16").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With

The line starting with "Selection" and ending with Type:=xlFillDefault" is
the one causing the issue.

Any advise? I'm not too advanced with the macro's, can record simple ones
but have a bit of trouble correcting them.
Thank you.

Monika

Monika


--

Dave Peterson