Problem to line

I get syntax error to this line
        If (Trim(ConfigWS.Cells(i, "D").Value) = "") Then Continue For

Open in new window

within one For loop. why?
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
"Continue For" is not really a proper syntax, if it's a comment, try:
If (Trim(ConfigWS.Cells(i, "D").Value) = "") Then //Continue For

Open in new window

If (Trim(ConfigWS.Cells(i, "D").Value) = "") Then
     //Continue For
End if

Open in new window

Michael FowlerSolutions ConsultantCommented:
Looks good but

1/ Is the value "i" declared and an integer or long type
2/ Has ConfigWS been created as a worksheet object

What exact error are you getting?

A single line of code often does not give us the information to correctly analyse the issue and so posting the workbook or at least posting the entire function will help us in resolving the issue
HuaMin ChenProblem resolverAuthor Commented:
I want to skip the loop, within If. What to adjust?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Wayne Taylor (webtubbs)Commented:
Yeah, "Continue For" isn't proper syntax.

Instead of looking to continue, look for something to not continue and perform your action....

For i = 1 To 100
    If Trim(ConfigWS.Cells(i, "D").Value) <> "" Then
        'Do your thing
    End If
End if

Open in new window

Ryan ChongCommented:
>>I want to skip the loop, within If. What to adjust?
If (Trim(ConfigWS.Cells(i, "D").Value) = "") Then
     Exit For
End if

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
Continue For is part of Visual Studio 2015.
If this is VBA, then you will need to do what I describe in this Next Iteration article:

// is not a valid comment indicator in VBA
Ryan ChongCommented:
>>// is not a valid comment indicator in VBA
exactly Aikimark... thks for highlighting, was posted too quickly and still thinking to code in C# environment...

we should use ' instead for commenting in VBA.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
exit is not the same as continue. Do you want to stop the loop (and continue with execution after the loop) or skip this loop iteration (and continue with the next loop value)?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.