Runtime 1004: Range class method failed

Creed2709

New Member
Joined
May 4, 2018
Messages
1
Hi MrExcel Forum,

First time poster (to any forums), was wondering if anyone can help me with this tiny bit of code on here. I see similar issues posted to the forums but nobody says what the underlying cause is so I'm not sure how to fix my particular situation.

What I want it to do:

Go to cell below the end of my table
Find the last non blank cell which contains a formula
autofill this formula to the bottom of the table for Col (F:J & O:Q)

This is what I have but I get the 1004 runtime error which I can't see whats causing it or why? I would repeat this formula for each column I would intend.

HTML:
endline = detailsht.range("f10000").end(xlup).row
currentlines = detailsht.range("f10000").end(xlup).end(xlup).row

detailsht.range("f100000").end(xlup).end(xlup).select                                              ''''''''this is the problem line.
selection.autofill destination:=detailsht.range("f" & currentlines & ":" & "f" & endline)


Any help would be much appreciated as I am new to VBA but keen to learn.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,440
Office Version
365
Platform
Windows
You can only use select on the active, so I suspect that your "detailsht" is not the active sheet.
 

Forum statistics

Threads
1,082,585
Messages
5,366,466
Members
400,892
Latest member
lamarh755

Some videos you may like

This Week's Hot Topics

Top