Problem to line

Hi,
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 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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 ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
"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

or
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?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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 ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>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.
aikimarkCommented:
If this is VBA, then you will need to do what I describe in this Next Iteration article:
http://rdsrc.us/VCFFaB

// is not a valid comment indicator in VBA
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>// 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.
Qlemo"Batchelor", 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.