Why is this sub not working?

Private Sub Command2_Click()
Dim i As Integer
For i = 0 To gridCurrent.Rows - 1
gridCurrent.TextMatrix(i, 1) = "row " & gridCurrent.Row & " Col " & 1

The grid only has 8 rows, but they all say:
Row 0 , Col 1
why do the rows not increment ?
Who is Participating?
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
you put the wrong variable:
For i = 0 To gridCurrent.Rows - 1
gridCurrent.TextMatrix(i, 1) = "row " & i & " Col " & 1

Open in new window

Shaun KlineConnect With a Mentor Lead Software EngineerCommented:
Are you referring to the same value being placed in column 1 of each row?

Most likely has to due with the reference to gridCurrent.Row in the For loop. This is a pointer to the current row, but you never change the current row.
isnoend2001Author Commented:
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.

All Courses

From novice to tech pro — start learning today.