+ Reply to Thread
Results 1 to 14 of 14

Loop formula until column to left has empty cell

  1. #1
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Loop formula until column to left has empty cell

    Hi gurus,

    I've written the below code to sum all payments on row 2 in the next blank column of worksheet w2 (see below).

    How can I have the below formula loop down the column until there is a blank cell in the column to the left i.e. Offset(0,-1)? I am trying to avoid using select and activecell etc.

    Thanks in advance! Any help is much appreciated

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,461

    Re: Loop formula until column to left has empty cell

    You don't need a loop. Post a sample workbook.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: Loop formula until column to left has empty cell

    Hi TMS, I think I do need a loop because this is part of a larger macro (the number of rows and columns with payments will vary each time it is run).

    Example attached. Columns A:AL are blank because I removed sensitive information.

    In this example, payments need to be summed from columns AN to KO in rows 2 to 1129.

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Loop formula until column to left has empty cell

    Try this:

    Please Login or Register  to view this content.
    Last edited by stnkynts; 09-15-2015 at 05:08 PM.
    If you are happy with my response please click the * in the lower left of my post.

  5. #5
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: Loop formula until column to left has empty cell

    I thought you guys would be able to do this easy!

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Loop formula until column to left has empty cell

    Quote Originally Posted by wannabeexcelguy View Post
    I thought you guys would be able to do this easy!
    See my post above

  7. #7
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: Loop formula until column to left has empty cell

    Thanks stnkynts but when I run this nothing happens :?

  8. #8
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: Loop formula until column to left has empty cell

    Ended up doing it the lame way unfortunately.

    Please Login or Register  to view this content.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,461

    Re: Loop formula until column to left has empty cell

    I'm willing to be proved wrong, but if you post a sample workbook, I'll try to demonstrate ... or hold my hands up

  10. #10
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Loop formula until column to left has empty cell

    I read your post wrong. Sorry about that.

  11. #11
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Loop formula until column to left has empty cell

    Here. No Loop.

    Please Login or Register  to view this content.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,461

    Re: Loop formula until column to left has empty cell

    Please Login or Register  to view this content.

    Regards, TMS

  13. #13
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: Loop formula until column to left has empty cell

    Awesome, these both work! Cheers gurus. Knew you guys could do better than me haha.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,461

    Re: Loop formula until column to left has empty cell

    You're welcome. Thanks for the rep.

+ 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. [SOLVED] Paste formula to the last empty cell based on a non-empty cell on another column
    By bhenlee in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-02-2015, 04:07 PM
  2. Loop through columns return no empty cell from column
    By miguelcubeles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-24-2015, 07:34 PM
  3. [SOLVED] Copy and paste values in column range into first empty column to the left
    By gbatz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2014, 06:59 PM
  4. [SOLVED] Loop to find cells based on criteria, enter formula into next empty column
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-10-2012, 03:32 PM
  5. looping through records of left column until cell is empty
    By johnmerlino in forum Excel General
    Replies: 1
    Last Post: 09-23-2010, 04:32 AM
  6. Replies: 3
    Last Post: 02-21-2007, 01:33 PM
  7. Formula to use number in cell to left & ignore any empty cells
    By joya in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-13-2007, 12:52 PM

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