+ Reply to Thread
Results 1 to 3 of 3

AutoFill Macro from ActiveCell Fail

  1. #1
    Registered User
    Join Date
    04-28-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    2

    AutoFill Macro from ActiveCell Fail

    Hi All,

    My name is Edward and I'm newbie to these forums. I would really appreciate if someone is able to help me as I have read every forum on this issue and tried every solution I can see but I'm still getting a Run-time error '1004' .

    I'm trying to create an autofill macro from an Active Cell in Column G that then fills down Column G and stops at the row where data exists in Column C. For example say the active cell is "G10" and I have text up to cell "C20", I would thus like the macro to autofill over the range G10:G20.

    My current autofill code is:

    Selection.AutoFill Destination:=Range(ActiveCell & Range("C" & lastRow))


    I'm not sure if this makes any difference but the data in Column C is text based and not numerical.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: AutoFill Macro from ActiveCell Fail

    Hi, Edward,

    your code assumes that you always will be in Column C. Give this a try:
    Please Login or Register  to view this content.
    This will look up the last filled row in Column C but work in the Column where the active cell resides.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    04-28-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: AutoFill Macro from ActiveCell Fail



    Thank you so much Holger that worked perfectly!

    You have seriously just made my day!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1