Run-time error '1004': autofill method of range class failed.

Hi all -
Need a quick fix for this macro.
It was working & has quit.  I commented out the original code & tried the "lastrow".  Obviously, I have screwed up how it should be - and my VB skills are bad @ best...
Any help would be greatly appreciated!
Thank you!


Dim lastrow As Long

lastrow = Range("Y65000").End(xlUp).Row


    'Copy formulas
    Sheets("DDC Checklist").Select
    Range("Y7:AI7").Select
                          'Selection.AutoFill Destination:=Range("Y7:AI506")
    Selection.AutoFill Destination:=Range("Y7:Y" & lastrow)
    Range("Y7:AI506").Select
       
   
    'Select Range A1 on DDC Sheet
    Range("A1").Select
   
    'Select Range A1 on Input Sheet
    Sheets("Input").Select
    Range("A1").Select
     
   
End Sub
jennifer georgeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsDistinguished Expert - 2017Commented:
Could you please post your full code?
0
jennifer georgeAuthor Commented:
Sub AddNewLineNewJob()

    Range("A4").Select
    Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.RowHeight = 18
    Rows("5:5").Select
    Selection.Copy
    Range("A4").Select
    ActiveSheet.Paste
    Range("D4:X4").Select
    Application.CutCopyMode = False
    Selection.ClearContents
   
    'Run macro to copy formulas on DDC sheet
   
    copy_formulae_DDC_Checklist
    Range("D4").Select

End Sub

Sub copy_formulae_DDC_Checklist()



'This macro updates the formulas on the 'DDC Checklist' sheet when a new row is inserted on the Input sheet.

Dim lastrow As Long

lastrow = Range("Y65000").End(xlUp).Row

    'Copy formulas
    Sheets("DDC Checklist").Select
    Range("Y7:AI7").Select
              'Selection.AutoFill Destination:=Range("Y7:AI506")
    Selection.AutoFill Destination:=Range("Y7:Y" & lastrow)
    Range("Y7:AI506").Select
     
    'Select Range A1 on DDC Sheet
    Range("A1").Select
   
    'Select Range A1 on Input Sheet
    Sheets("Input").Select
    Range("A1").Select
     
End Sub
0
ShumsDistinguished Expert - 2017Commented:
Try below:
Sub AutoFill()
Dim Ws As Worksheet
Dim lastRow As Long
Set Ws = Worksheets("DDC Checklist")
lastRow = Ws.Range("Y" & Rows.Count).End(xlUp).Row
Ws.Range("Y7").AutoFill Destination:=Ws.Range("Y7:AI" & lastRow)
End Sub

Open in new window

0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

jennifer georgeAuthor Commented:
Same error...
0
ShumsDistinguished Expert - 2017Commented:
Are you running my code separately or you are calling from your original code?
0
ShumsDistinguished Expert - 2017Commented:
Paste above code in your module and run macro AutoFill
0
jennifer georgeAuthor Commented:
I called it from the new line macro.  And I added the indented line...

Sub AutoFill()
Dim Ws As Worksheet
Dim lastRow As Long
Set Ws = Worksheets("DDC Checklist")
lastRow = Ws.Range("Y" & Rows.Count).End(xlUp).Row
       Ws.Range("Y7:AI7").Select
Ws.Range("Y7").AutoFill Destination:=Ws.Range("Y7:AI" & lastRow)
End Sub
0
ShumsDistinguished Expert - 2017Commented:
Try below:
Sub AutoFill()
Dim Ws As Worksheet
Dim lastRow As Long
Set Ws = Worksheets("DDC Checklist")
lastRow = Ws.Range("Y" & Rows.Count).End(xlUp).Row
Ws.Range("Y7:AI7").AutoFill Destination:=Ws.Range("Y7:AI" & lastRow)
End Sub

Open in new window

0
jennifer georgeAuthor Commented:
It doesn't do anything w/out the select.
0
ShumsDistinguished Expert - 2017Commented:
Have you tried with select?
0
jennifer georgeAuthor Commented:
I will.  Have to run to a meeting
0
ShumsDistinguished Expert - 2017Commented:
You try without Select
0
jennifer georgeAuthor Commented:
It was a KB that caused the issue
0
ShumsDistinguished Expert - 2017Commented:
What is KB?
0
jennifer georgeAuthor Commented:
One of the M$ KB Updates broke it.  I uninstalled the Update & now it works.
0
jennifer georgeAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for jennifer george's comment #a42066184

for the following reason:

I uninstalled KB 3178690 & now it works again
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShumsDistinguished Expert - 2017Commented:
Sorry, problem was not from my side, I did gave you solution.
Please assign points reasonably.
0
jennifer georgeAuthor Commented:
I wasn't trying to not give you points.  What I was trying to do was alert others of a possible issue that was not code related.  i don't need the points...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.