+ Reply to Thread
Results 1 to 9 of 9

LAST ROW HELP. For i to n.... where n=last row! Loop help :(

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    52

    LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    Hi,
    I want to put a formula in column AG when there is data in column A, from rows 6 to n, where n is the last data row.
    My code works when I make it "For i=6 To 100" etc, so what's wrong with my n?
    Please help.

    Please Login or Register  to view this content.
    Last edited by JosephP; 11-22-2012 at 10:58 AM. Reason: add code tags

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    I THINK YOU JUST NEED TO USE

    For i = 6 to n

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    hi KATIEexcel, do remember to put code tags. i think this should be what you need:

    Please Login or Register  to view this content.
    the n is just for VBA to know when to stop.

    a suggestion for "n" too. in case if you use .xlsx files, the end row is 1 million+. so use this instead:
    Please Login or Register  to view this content.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Registered User
    Join Date
    10-30-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    Thanks for your help but that didn't work either.
    When it's i= 6 to n (as opposed to an actual number), column AG is blank.
    Any idea why?

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    if you are checking for data in column A then
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.
    because column 2 is column B ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Registered User
    Join Date
    10-30-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    Haha oh yeah, you're clever. Thanks. I didn't notice that. I did mean B though, not A.
    Stuck

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    if you meant column B then you probably need
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-30-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    You genius! Thanks, fixed it

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: LAST ROW HELP. For i to n.... where n=last row! Loop help :(

    you're welcome :-)

    please don't forget to mark the thread solved

+ 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