+ Reply to Thread
Results 1 to 2 of 2

How to loop through cells in a range and then apply a formula to an offset to that range.

  1. #1
    Registered User
    Join Date
    07-20-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    59

    How to loop through cells in a range and then apply a formula to an offset to that range.

    Hi All,

    I am something of a VBA novice. I have written some code that selects (literally) every nth cell (n is a variable) in a long row range and then applies a formula to an offset to that cell. No doubt the experts here will realize that all this selecting slows the code down considerably. Can anyone show me how to use such a loop more efficiently. I thought about a combination of a For Next loop with step so that I would have something like:

    Please Login or Register  to view this content.
    I hope this makes some kind of sense.

    TIA,

    Andrew

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to loop through cells in a range and then apply a formula to an offset to that ran

    Hi, Andrew.

    For Each...Next doesnŽt support a Step parameter. You could work around that using a counter like this:
    Please Login or Register  to view this content.
    IŽd prefer to use somethin glike
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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