Private Sub cmdList_Click()
' Set start_row to the smaller of MSFlexGrid1.Row
' and MSFlexGrid1.Row. Make stop_row the larger.
If MSFlexGrid1.Row > MSFlexGrid1.RowSel Then
start_row = MSFlexGrid1.RowSel
stop_row = MSFlexGrid1.Row
Else
start_row = MSFlexGrid1.Row
stop_row = MSFlexGrid1.RowSel
End If
' Loop through the selected rows.
For i = start_row To stop_row
txt = txt & MSFlexGrid1.TextMatrix(i, 0) & ": " & _
MSFlexGrid1.TextMatrix(i, 1) & vbCrLf
Next i
MsgBox txt
End Sub
|