• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

counting cells in mshflexgrid with cell's color (invalid row error)

I get invalid row error in the line below.Please help

Dim T1counter
Dim T2lcounter
T1 = 0
T2 = 0

Dim mycounter
For mycounter = 1 To MSFlexGrid1.Rows
    MSFlexGrid1.row = mycounter  <-----------------------invalid Row value error?
    MSFlexGrid1.col = 5
If MSFlexGrid1.CellForeColor = vbCyan Then
 If MSFlexGrid1.Text = "T1" Then
   T1 = T1 + 1
 End If
 If MSFlexGrid1.Text = "T2" Then
   T2 = T2 + 1
 End If
End If

Next mycounter


Thank you.
0
Aiysha
Asked:
Aiysha
1 Solution
 
bruintjeCommented:
Hi Aiysha,
----------

when do you get that error on the first counter or on the end try using

  For i = 1 To MSFlexGrid1.Rows - 1

  Next i

this worked here for me, the grid starts counting at row 0 so if you have a header row which is 0 and 10 normal rows rows element has 11 rows but you need to fill 10 rows so rows - 1

----------
bruintje
share what you know, learn what you don't
0
 
AiyshaAuthor Commented:
it works fine thank you.
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now