Question

  • Creator
    Topic
  • #2141760

    Fill cells in a column with the same term then stop filling when data ends

    by weylered ·

    Tags: 

    WIN 10, Excel 2016.  I volunteer IT at a homeless center.  We use a sign in sheet drawn from Salesforce, downloaded into Excel then massaged by a macro to produce the printed list.  They want one column to have the term “shelter out” in every cell one column to mark where the client stayed the night before.

    I can get the column to fill each cell correctly but I need it to stop filling when there is no more data in the other columns.  So, one day the list will have 651 clients, the next day it might have 670.

    Below is the fill function from the macro.  How do I get it to stop when there is no data in adjoining cells?
    Sub Macro1()

    ‘ Macro1 Macro


    Range(“J1”).Select
    ActiveCell.FormulaR1C1 = “out apt shelt”
    Columns(“J:J”).Select
    Selection.FillDown
    End Sub

    Thanks for the help!

You are posting a reply to: Fill cells in a column with the same term then stop filling when data ends

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

  • Author
    Replies
    • #2415527
      Avatar photo

      Re:macro

      by kees_b ·

      In reply to Fill cells in a column with the same term then stop filling when data ends

      You’ll have to write a loop, starting in J1, and go down one cell at a time until the other cells in the current row are empty. Then stop.

      A good programmer knows to handle the special case where row 1 is already empty. I don’t think it’s necessary to handle the special case when you’re at the very bottom of the spreadsheet (there’s a maximum of around 1 million rows in an .xlsx file).

Viewing 0 reply threads