Hola! te envio este ejemplo, no usa Datagrid, usa MSFlexgrid. Lo que hace es mostrar como hacer para simular la edicion de una celda. En el ejemplo al tipear algo en alguna celda de las columnas "Valores1" o "Valores2" se habilitan los textbox correspondientes y al presionar <enter> se graba el valor en la celda. En la columna "Desplegable" se abre el listbox para seleccionar alguna opcion y tambien al dar <enter> se almacena en la celda.
Para probar el ejemplo, en un form agrega un msflexgrid, 2 textbox y 1 listbox, (no le cambies los nombres por defecto a los controlse) y copia el codigo siguiente en la seccion general del form.
Option Explicit
Private Sub Form_Load()
' Ocultar los textbox y el listbox
Text1.Visible = False
Text1.BorderStyle = 0 'None
Text2.Visible = False
Text2.BorderStyle = 0 'None
List1.Visible = False
List1.Appearance = 0 'Flat
' Agrego valores al listbox
List1.AddItem "Item UNO"
List1.AddItem "Item DOS"
List1.AddItem "Item TRES"
'Configurar el Grid para el ejemplo
With MSFlexGrid1
.Cols = 5
.Rows = 11
.TextMatrix(0, 2) = "Valores 1"
.TextMatrix(0, 3) = "Valores 2"
.TextMatrix(0, 4) = "Desplegable"
End With
End Sub
Private Sub List1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
With MSFlexGrid1
.TextMatrix(.RowSel, 4) = List1.Text
.SetFocus
End With
End If
If KeyAscii = vbKeyEscape Then
MSFlexGrid1.SetFocus
KeyAscii = 0
End If
End Sub
Private Sub MSFlexGrid1_GotFocus()
Text1.Visible = False
Text2.Visible = False
List1.Visible = False
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
With MSFlexGrid1
Select Case .ColSel
Case 2
Text2.Visible = False
List1.Visible = False
Text1.Move .Left + .CellLeft, .Top + .CellTop, .CellWidth - 8, .CellHeight - 8
Text1.Visible = True
If .TextMatrix(.RowSel, .ColSel) <> "" Then
Text1.Text = .TextMatrix(.RowSel, .ColSel)
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Else
Text1.Text = Chr(KeyAscii)
Text1.SelStart = 1
End If
Text1.SetFocus
Case 3
Text1.Visible = False
List1.Visible = False
Text2.Move .Left + .CellLeft, .Top + .CellTop, .CellWidth - 8, .CellHeight - 8
Text2.Visible = True
If .TextMatrix(.RowSel, .ColSel) <> "" Then
Text2.Text = .TextMatrix(.RowSel, .ColSel)
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Else
Text2.Text = Chr(KeyAscii)
Text2.SelStart = 1
End If
Text2.SetFocus
Case 4
Text1.Visible = False
Text2.Visible = False
List1.Move .Left + .CellLeft, .Top + .CellTop, .CellWidth - 8
List1.Visible = True
If .TextMatrix(.RowSel, .ColSel) <> "" Then
List1.Text = .TextMatrix(.RowSel, .ColSel)
End If
List1.SetFocus
End Select
End With
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
With MSFlexGrid1
.TextMatrix(.RowSel, 2) = Text1.Text
.SetFocus
End With
KeyAscii = 0
End If
If KeyAscii = vbKeyEscape Then
MSFlexGrid1.SetFocus
KeyAscii = 0
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
With MSFlexGrid1
.TextMatrix(.RowSel, 3) = Text2.Text
.SetFocus
End With
KeyAscii = 0
End If
If KeyAscii = vbKeyEscape Then
MSFlexGrid1.SetFocus
KeyAscii = 0
End If
End Sub
Bueno espero te sirva