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

Posted on 2006-05-25
Medium Priority
Last Modified: 2010-04-17
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.
Question by:Aiysha
LVL 44

Accepted Solution

bruintje earned 2000 total points
ID: 16762863
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

share what you know, learn what you don't

Author Comment

ID: 16763015
it works fine thank you.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Screencast - Getting to Know the Pipeline

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question