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.

ShumsExcel & VBA ExpertCommented:
Could you please post your full code?
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
ShumsExcel & VBA ExpertCommented:
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

Price Your IT Services for Profit

Managed service contracts are great - when they're making you money. Yes, you’re getting paid monthly, but is it actually profitable? Learn to calculate your hourly overhead burden so you can master your IT services pricing strategy.

jennifer georgeAuthor Commented:
Same error...
ShumsExcel & VBA ExpertCommented:
Are you running my code separately or you are calling from your original code?
ShumsExcel & VBA ExpertCommented:
Paste above code in your module and run macro AutoFill
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
ShumsExcel & VBA ExpertCommented:
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

jennifer georgeAuthor Commented:
It doesn't do anything w/out the select.
ShumsExcel & VBA ExpertCommented:
Have you tried with select?
jennifer georgeAuthor Commented:
I will.  Have to run to a meeting
ShumsExcel & VBA ExpertCommented:
You try without Select
jennifer georgeAuthor Commented:
It was a KB that caused the issue
ShumsExcel & VBA ExpertCommented:
What is KB?
jennifer georgeAuthor Commented:
One of the M$ KB Updates broke it.  I uninstalled the Update & now it works.
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

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
ShumsExcel & VBA ExpertCommented:
Sorry, problem was not from my side, I did gave you solution.
Please assign points reasonably.
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...
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.