+ Reply to Thread
Results 1 to 5 of 5

Changing my code to loop through a list of cells (lots of reference cells)

  1. #1
    Forum Contributor
    Join Date
    06-25-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    179

    Changing my code to loop through a list of cells (lots of reference cells)

    Hi All,

    I built a piece of code that does the exact job i want once, but i need it to loop through a range and continue the process until the range is empty.

    For the sake of simpleness and because i want to learn i won't provide the whole code, but if i have this set up how would i get each of these ranges to move down by 1 cell each time untill the loop is complete:

    The range that starts in 47, 3 or AU4 in sheet terms should go down by one make sure its not blank and if its not everything else should move down in line with it.


    Please Login or Register  to view this content.

    Thanks for the help.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,626

    Re: Changing my code to loop through a list of cells (lots of reference cells)

    My frank suggestion do not use Select and Selection unless you have to.

    Please Login or Register  to view this content.
    PS. As you refer to AU4 - shouldnt offset be 3,47 (row,column) - not seeing code, neither workbook it's just guess, but quite probable one.

    Anyway: always Offset (rows, columns).
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    06-25-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    179

    Re: Changing my code to loop through a list of cells (lots of reference cells)

    Hi you are correct i meant to use 3, 47. what would you suggest i do it without selection?

    regards,
    Joshua

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,626

    Re: Changing my code to loop through a list of cells (lots of reference cells)

    Exactly what I said and shown in code.
    Please Login or Register  to view this content.
    is the way macro is registered.
    But when you write it only slows down code.
    Please Login or Register  to view this content.
    is usually much quicker and shorter way.

  5. #5
    Forum Contributor
    Join Date
    06-25-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    179

    Re: Changing my code to loop through a list of cells (lots of reference cells)

    Ah sorry i misread what you had written.
    Thanks for the pointers!

+ 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. Changing reference cells...
    By Lanner7 in forum Excel General
    Replies: 2
    Last Post: 09-14-2011, 08:48 PM
  2. Changing the reference formula cells ?????
    By Sokol in forum Excel General
    Replies: 3
    Last Post: 06-02-2010, 08:52 AM
  3. Inserting cells without changing reference
    By bobfree in forum Excel General
    Replies: 1
    Last Post: 12-28-2008, 04:57 AM
  4. For next loop carries on after criteria is met changing other cells????
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-07-2006, 03:45 PM
  5. Changing mulitple cells to absolute reference.
    By Randman in forum Excel General
    Replies: 1
    Last Post: 02-20-2005, 06:52 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