Try this - the magic row is #4 and space will check the checkboxEdit: it also needs this Sub (attachment updated):VB Code:
Private Sub Check1_Click() MSFlexGrid1.SetFocus End Sub Private Sub Form_Load() Check1.Visible = False End Sub Private Sub MSFlexGrid1_EnterCell() With MSFlexGrid1 If .Row = 4 Then Check1.Left = .Left + .ColPos(.Col) + (.ColWidth(.Col) - Check1.Width) \ 2 Check1.Top = .Top + .RowPos(.Row) + (.RowHeight(.Row) - Check1.Height) \ 2 Check1.Value = Val(.TextMatrix(.Row, .Col)) Check1.Visible = True End If End With End Sub Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer) If MSFlexGrid1.Row = 4 Then If KeyAscii = 32 Then Check1.Value = Abs(Not CBool(Check1.Value)) End If End Sub Private Sub MSFlexGrid1_LeaveCell() With MSFlexGrid1 If .Row = 4 Then .TextMatrix(.Row, .Col) = Check1.Value Check1.Visible = False End If End With End SubEdit2: another slight change to code (in bold above) - attachment not updatedVB Code:
Private Sub MSFlexGrid1_Scroll() With MSFlexGrid1 If Not (.RowIsVisible(.Row) And .ColIsVisible(.Col)) Then Check1.Visible = False Else[B]If .Row = 4 Then[/B] Check1.Left = .Left + .ColPos(.Col) + (.ColWidth(.Col) - Check1.Width) \ 2 Check1.Top = .Top + .RowPos(.Row) + (.RowHeight(.Row) - Check1.Height) \ 2 Check1.Visible = True End If End With End Sub




Reply With Quote