2011年4月27日 星期三

MSFlexGrid 取得已選取的列(支援多列)

參考來源
----
真是找好久,收藏起來!!

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

沒有留言:

張貼留言