|
-
Jul 11th, 2000, 08:47 PM
#3
Thread Starter
PowerPoster
Hi Graham! I very much appreciate you responding to my post, since I often seem to pose questions that don't generate many responses (I was beginning to get a complex).
Anywho, after further research I was able to figure out how to do what I needed to do. ...And the results of my findings are as follows (Peter Criss, drum roll please) :
(1) Your suggestion on using the MouseRow/MouseCol properties work best when you want to grab (read) the data at one particular cell; this is good to know, but not what I wanted to do for this problem. What I wanted to do is find the starting and ending row for the range of rows the user selected. The starting row is given by the Row property and the ending row is given by the RowSel property.
(2)When I say I want to "extract" data, I mean I want to read the data that's in a particular cell so I can stick it in a variable and use it for further processing. To do this, you have to set the Row and Col properties of the grid, then the content is given by the Text property.
My real project is at work, but here at home I slapped together an example that will do what I want:
Code:
'command button clicked after user selects a range of rows ...
Private Sub Command1_Click()
Dim intFirstRowSelected As Integer
Dim intLastRowSelected As Integer
Dim intX As Integer
Dim strItem1 As String
Dim strItem2 As String
intFirstRowSelected = MSFlexGrid1.Row
intLastRowSelected = MSFlexGrid1.RowSel
For intX = intFirstRowSelected To intLastRowSelected
MSFlexGrid1.Row = intX
MSFlexGrid1.Col = 1
strItem1 = MSFlexGrid1.Text
MSFlexGrid1.Col = 2
strItem2 = MSFlexGrid1.Text
Debug.Print strItem1, strItem2
Next
End Sub
Again, Graham, I appreciate your efforts and hopefully we both learned something about MSFlexGrid.
"It's cold gin time again ..."
Check out my website here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|