+ Reply to Thread
Results 1 to 7 of 7

VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    Hi
    What would be the most efficient or easiest VBA to achieve below:

    VBA would fill all the all the empty cells in col I with value "OPEN". This would be from cell I2 (inclusive) downwards as far as the rows go in col A.


    So the below would change:
    From this:


    -------------- -------------- Col A ----------------------------- Col I
    Row 1 -------------- order number ---------- Schedule State
    Row 2 -------------- Order 1 ---------------------- RECEIVED
    Row 3 -------------- Order 2 ---------------------- RECEIVED
    Row 4 -------------- Order 3 ---------------------- RECEIVED
    Row 5 -------------- Order 4 ---------------------- --------------
    Row 6 -------------- Order 5 ---------------------- --------------
    Row 7 -------------- Order 6 ---------------------- --------------
    Row 8 -------------- Order 7 ---------------------- --------------
    Row 9 -------------- -------------- ---------------------- --------------
    Row 10 -------------- -------------- ---------------------- --------------
    Row 11 -------------- -------------- ---------------------- --------------
    Row 12 -------------- -------------- ---------------------- --------------
    Row 10 -------------- -------------- ---------------------- --------------


    To this:

    -------------- -------------- Col A ----------------------------- Col I
    Row 1 -------------- order number ---------- Schedule State
    Row 2 -------------- Order 1 ---------------------- RECEIVED
    Row 3 -------------- Order 2 ---------------------- RECEIVED
    Row 4 -------------- Order 3 ---------------------- RECEIVED
    Row 5 -------------- Order 4 ---------------------- OPEN
    Row 6 -------------- Order 5 ---------------------- OPEN
    Row 7 -------------- Order 6 ---------------------- OPEN
    Row 8 -------------- Order 7 ---------------------- OPEN
    Row 9 -------------- -------------- ---------------------- --------------
    Row 10 -------------- -------------- ---------------------- --------------
    Row 11 -------------- -------------- ---------------------- --------------
    Row 12 -------------- -------------- ---------------------- --------------
    Row 10 -------------- -------------- ---------------------- --------------


    Columns are always arranged by column I so the empty cell ones will always be at the bottom. It would be nice to have a solution that does not loop. Any help is always appreciated.
    Attached Files Attached Files
    Last edited by rain4u; 10-17-2011 at 06:53 PM.

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    If You are interested in solution without VBA then select range “I441: I1” press F5 (special) mark empty cells, put “OPEN” text and hit CTRL + ENTER

    with VBA
    Please Login or Register  to view this content.
    Last edited by tom1977; 10-17-2011 at 06:09 PM.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    Tom, you suggest a manual method that uses the Special Cells method, great! But then a VBA approach that doesn't use the same efficient technique?

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 10-17-2011 at 07:04 PM. Reason: correct typo
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    Good stuff mate.
    Much appreciated!

  5. #5
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    JBeaucaire
    Of course You right it's thousand times faster..
    regards

  6. #6
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    Quote Originally Posted by JBeaucaire View Post
    Tom, you suggest a manual method that uses the Special Cells method, great! But then a VBA approach that doesn't use the same efficient technique?

    Please Login or Register  to view this content.
    Errors out. " Method 'Range' of object '_Global' failed.

    with line below:
    LR = Range("A " & Rows.Count).End(xlUp).Row

    I like the 2 line code. Any ideas?

  7. #7
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    Re: VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A

    Please Login or Register  to view this content.
    Got it. Simple typo. extra space "A ". Should read "A"


    As its probably impossible to do it any faster than this, I will put it as solved.
    Thank you both.

+ 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