View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
murkaboris murkaboris is offline
external usenet poster
 
Posts: 76
Default Run-time error '1004': AutoFill method of Range class failed

Hello Per:

I'm not sure I understand, sorry I'm a bit new to writing macros.
Is there any way you could adjust the macro section per your note?
Where would I insert the ActiveCell C9?

Here is the section that's causing the issue....this is the beginning of my
macro...:

ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R3C1,'[ATF master file.xls]Orders OP'!R3C4:R55C15,2,FALSE)"
ActiveCell.Select
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

thank you.
Monika

"Per Jessen" wrote:

Hi

Active cell has to be first cell in fill range.

You could active C9 before ActiveCell.Formula.... with this statement if you
always want to fill the same range:

Range("C9").Select

Hopes this helps.

---
Per

"murkaboris" skrev i meddelelsen
...
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