Private Sub Form_Load()
With MSFlexGrid1
.Row = 1
.Col = 1
.Text = "524312"
.Col = 2
.Text = "dfd3333"
.Col = 3
.Text = "euui33"
End With
End Sub
Private Sub Command1_Click()
Dim strA As String
Dim strB As String
Dim strC As String
Dim strR(3) As String
Dim intS(3) As Integer
Dim strT As String
Dim i As Integer
Dim j As Integer
strA = "2"
strB = "4"
strC = "d"
With MSFlexGrid1
.Row = 1
For j = 1 To 3
.Col = j
intS(j - 1) = Len(.Text)
Next j
For j = 1 To 3
.Col = j
For i = 1 To Len(.Text)
If Mid(.Text, i, 1) = strA Then
.Text = Left(.Text, i - 1) & Mid(.Text, i + 1, Len(.Text))
strR(j - 1) = strA
Exit For
ElseIf Mid(.Text, i, 1) = strB Then
.Text = Left(.Text, i - 1) & Mid(.Text, i + 1, Len(.Text))
strR(j - 1) = strB
Exit For
ElseIf Mid(.Text, i, 1) = strC Then
.Text = Left(.Text, i - 1) & Mid(.Text, i + 1, Len(.Text))
strR(j - 1) = strC
Exit For
End If
Next i
Next j
For j = 1 To 3
.Col = j
.Text = .Text & strR(IIf(j = 3, 0, j))
Next j
For j = 3 To 1 Step -1
.Col = j
If Len(.Text) > intS(j - 1) Then
strT = Left(.Text, Len(.Text) - intS(j - 1))
.Text = Mid(.Text, Len(strT) + 1, Len(.Text))
.Col = IIf(j = 1, 3, j - 1)
.Text = .Text & strT
End If
Next j
End With