Private Sub msfg_EnterCell()
colocaText
End Sub
Private Sub txtEditaCelda_Change()
msfg.Text = txtEditaCelda.Text
End Sub
Private Sub txtEditaCelda_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyUp
If msfg.Row > 0 Then
msfg.Row = msfg.Row - 1
End If
Case vbKeyDown
If msfg.Row < msfg.Rows - 1 Then
msfg.Row = msfg.Row + 1
End If
Case vbKeyLeft
If txtEditaCelda.SelStart = 0 Then
If msfg.Col > 0 Then
msfg.Col = msfg.Col - 1
End If
End If
Case vbKeyRight
If txtEditaCelda.SelStart = Len(txtEditaCelda.Text) Then
If msfg.Col < msfg.Cols - 1 Then
msfg.Col = msfg.Col + 1
End If
End If
End Select
End Sub
' Coloca el textBox sobre la celda actual
Private Sub colocaText()
With txtEditaCelda
.Move msfg.CellLeft + msfg.Left, msfg.CellTop + msfg.Top, msfg.CellWidth, msfg.CellHeight
.Visible = True
.ZOrder 0
.Text = msfg.Text
.SetFocus
.SelStart = Len(txtEditaCelda.Text)
End With
End Sub