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 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

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

Open in new window

0
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
0
HuaMin ChenProblem resolverAuthor Commented:
I want to skip the loop, within If. What to adjust?
0
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

0
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

??
0

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.
0
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
0
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.
0
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)?
0
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.