Excel: Next Iteration with VBA

Posted on 2011-10-20
Last Modified: 2012-08-14
Is there any way to skip an iteration in For.. Next Iteration ?

My Script is something like this :
 For i = 2 To TotalRows
            If Selection.Offset(i - 1, -7).Value = "" Then
                Next i
            End If
            [commands goes here]
Next i

Open in new window

so basically i would like to check a value (in this case empty cell), if its true than skip the iteration to next value
Question by:veematics
    LVL 8

    Assisted Solution

    You can implement as follows :
    For i = 2 To TotalRows
                If Selection.Offset(i - 1, -7).Value <> "" Then
                      'Write you code here
                End If
    Next i
    LVL 8

    Expert Comment

    So in IF condition, I have converted '=' sign to '<>' sign.
    LVL 44

    Accepted Solution

    I wrote an article on how to do this:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
    This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now