Avatar of isnoend2001
isnoend2001
Flag for United States of America asked on

why does this sub give error

this code gives invalid next control reference
Sub ReSetForColorFlexStatus() 'set the forcolor flexstatus from red to blue
     Dim r As Integer
     Dim c As Integer
     With flexStatus
    For r = 1 To .Rows - 1
    For c = 0 To .Cols - 1
    .CellForeColor = vbBlue
    Next r
    Next c
    End With
End Sub

Open in new window

what is wrong ?
Visual Basic Classic

Avatar of undefined
Last Comment
Martin Liss

8/22/2022 - Mon
Martin Liss

Sub ReSetForColorFlexStatus() 'set the forcolor flexstatus from red to blue
     Dim r As Integer
     Dim c As Integer
     With flexStatus
    For r = 1 To .Rows - 1
    For c = 0 To .Cols - 1
   .Row = r
   .Col = c
    .CellForeColor = vbBlue
    Next r
    Next c
    End With
End Sub

Open in new window

isnoend2001

ASKER
Thanks MartinLiss
that gives the same error
this is highlighted:
Next r
ASKER CERTIFIED SOLUTION
Martin Liss

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
isnoend2001

ASKER
thanks MartinLiss, learn something new everyday
glad you are there
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Martin Liss

Thank. I'm glad I was able to help.

Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013