+ Reply to Thread
Results 1 to 8 of 8

VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

  1. #1
    Registered User
    Join Date
    05-23-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    37

    Smile VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    Hi Experts,

    I am trying to use a VBA code for Selection Auto Fill Down, however, the code is not recognizing the next filled cells, so that it stops in previous cell & applies the code again till it reaches a cell before "-*-" which is at Cell B28, in the attached sample sheet

    Its because the cell content or number is not recognizable in column B.

    Appreciate anyones help, as original file has around 1000 rows.

    Regards
    Ram
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    This code works although it fills the whole range with whatever is in cell B5

    Please Login or Register  to view this content.

  3. #3
    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: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    Hi, Ram,

    maybe this line of code works like expected:
    Please Login or Register  to view this content.
    As Column B has more values beyond row 27 that would return the number of the last row and would be needed to be limited to 27 in any case (you woukld need to break down the Autofill to pieces for each number).

    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

  4. #4
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    This code works although it fills the whole range with whatever is in cell B5

    Please Login or Register  to view this content.

  5. #5
    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: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    Hi, Phil,

    from what I read there are 2 limitations: only work until row 27 and have different values to fill up (not just one):
    ...so that it stops in previous cell & applies the code again till it reaches a cell before "-*-" which is at Cell B28...
    Ciao,
    Holger

  6. #6
    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: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    Hi, Ram,

    a sample for breaking the code up into a loop may look like this:
    Please Login or Register  to view this content.
    I need to add to the line of code from my first post that you would need to use
    Please Login or Register  to view this content.
    before the codeline as the command would raise an error if no empty cells are found and
    Please Login or Register  to view this content.
    after the line.

    Ciao,
    Holger
    Last edited by HaHoBe; 02-24-2016 at 06:16 AM. Reason: get values filled down rather than update via AutoFill

  7. #7
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    Hi HaHoBe

    The forum decided to post that post twice 27 minutes apart. Don't know why?

    All I did was make it autofill whatever was in column B down to the cell above -*-, I didn't look into what it was supposed to fill because I couldn't see what he was trying to do

    Cheers

  8. #8
    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: VBA Code to Auto Fill Down till Next Filled Cell & reapply the code with new value

    Hi, Phil,

    The forum decided to post that post twice 27 minutes apart. Don't know why?
    EF´s installinmg all new gimmicks instead of fixing old and too well known errors?

    Performance of the Forum is bad this morning, and I doubt that the "Technical" Team involved by now will ever get the Forum to run without any flaws.

    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto-Fill Column with the last cell in a row that is filled
    By excelnoob927 in forum Excel General
    Replies: 1
    Last Post: 04-08-2015, 05:58 PM
  2. [SOLVED] how to auto fill cell with vba code
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2013, 01:18 AM
  3. [SOLVED] Code is not making cells with no color filled. Can not apply NO FILL to spreadsheet.
    By Flowerski in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-01-2012, 08:35 AM
  4. Replies: 2
    Last Post: 02-29-2012, 11:55 AM
  5. Code the saves filter info to reapply after running other code
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-25-2011, 05:49 PM
  6. [SOLVED] Can I auto fill a cell in one worksheet by typing a code number
    By Gomer Pyle in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  7. [SOLVED] Can I auto fill a cell in one worksheet by typing a code number
    By Gomer Pyle in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

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