Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Why is this sub not working?

Posted on 2014-01-10
3
Medium Priority
?
192 Views
Last Modified: 2014-01-10
Private Sub Command2_Click()
Dim i As Integer
For i = 0 To gridCurrent.Rows - 1
gridCurrent.TextMatrix(i, 1) = "row " & gridCurrent.Row & " Col " & 1
Next


The grid only has 8 rows, but they all say:
Row 0 , Col 1
why do the rows not increment ?
0
Comment
Question by:isnoend2001
3 Comments
 
LVL 27

Assisted Solution

by:Shaun Kline
Shaun Kline earned 800 total points
ID: 39771099
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.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1200 total points
ID: 39771124
you put the wrong variable:
For i = 0 To gridCurrent.Rows - 1
gridCurrent.TextMatrix(i, 1) = "row " & i & " Col " & 1
Next 

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 39771138
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

926 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