I wanted the user to select a 2
- Dimensional array of cells on the MSHFlexgrid. After the user selects the
block of Cells, he should be able to Cut/Copy/Paste or simply do whatever he
wants with the block .... i.e. full flexibility should be given... Can anybody
help me??
Well we can get the start and
end of the block selection by the following code....and using a for loop....we
can store the data in a 2-dimensional array :
Option
Explicit
Private Sub Form_Load()
Dim i As Integer
Dim j As
Integer
With MSFlexGrid1
For i = 0 To .Rows - 1
For j =
0 To .Cols - 1
.TextMatrix(i, j) = "(" & i &
"," & j & ")"
Next
Next
End With
End Sub
Private Sub MSFlexGrid1_EnterCell()
''color cell
With
MSFlexGrid1
.CellFontBold = True
.CellBackColor
= SystemColorConstants.vbHighlight
.CellForeColor =
SystemColorConstants.vbHighlightText
End With
End Sub
Private
Sub MSFlexGrid1_LeaveCell()
''Discolor cell
With MSFlexGrid1
.CellFontBold = False
.CellBackColor =
SystemColorConstants.vbWindowBackground
.CellForeColor =
SystemColorConstants.vbWindowText
End With
End Sub
Private
Sub MSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As
Single)
If Button = vbLeftButton Then
With MSFlexGrid1
Label1.Caption = "Range selected From (" & .Row & ","
& .Col & ") To (" & .RowSel & "," & .ColSel & ")"
End With
End If
End Sub
Neeraj Shinde