Visual Basic - COMPARACION DE CELDAS EN FLEXGRID

Life is soft - evento anual de software empresarial
 
Vista:

COMPARACION DE CELDAS EN FLEXGRID

Publicado por CATITA ZARATE (3 intervenciones) el 14/12/2005 00:17:42
Hola les planteo mi siguiente codigo que me funciona sin ningun problema pero yo quiero agregarle que solamente me acepte el numero(COLUMNA =6) que sea menor al que contiene la columna = 5
Quise condicionar de la siguiente manera If IsNumeric(.TextMatrix(.Row, 6)) < isNumeric(.TextMatrix(.Row, 5)) Then pero no me resulta espero su ayuda gracias
Agradecida
Hasta pronto
Catita Zarate(la peruana chevere)

Private Sub MSFlexGrid1_keypress(keyascii As Integer)
If keyascii >= 32 And keyascii <= 127 And MSFlexGrid1.Col = 6 Then
MSFlexGrid1.Text = MSFlexGrid1.Text & Chr(keyascii)
End If
Select Case keyascii
Case vbKeyReturn, vbKeyTab
'mueve para la proxima celda.
With MSFlexGrid1
If ((.Col + 6 < .cols - 1) Or .Col = 5) Then
‘COLUMNA 6 SE ACTIVA PORQUE ESATABA OCULTA
.ColWidth(6) = 960
.Col = .Col + 1
‘SE POSICIONA EN LA COLUMNA 6 PARA DIGITAR EL NUMERO
ElseIf .Col = 6 Then
For Z = 1 To .Rows - 1
.Row = Z
‘PREGUNTO SI LO DIGITADO ES NUMERO
If IsNumeric(.TextMatrix(.Row, 6)) Then
‘ SI SE CUMPLE LA CONDICION EL NUMERO DIGITADO ES COLOR ROJO Y LA FILA COMPLETA SE COLOREA DE VERDE
.CellForeColor = vbRed
For A = 1 To .cols - 1
.Col = A
.CellBackColor = RGB(100, 184, 150)
.Col = 6
Next A
‘PREGUNTO SI AL NUMERO DIGITADO SE LE AGREGA ACCIDENTALMENTE UNA CADENA LO
PINTA DE NEGRO Y TODA LA FILA SE PONE DE COLOR BLANCO
ElseIf Not IsNumeric(.TextMatrix(.Row, 6)) _
And .CellForeColor = vbRed Then
For A = 1 To .cols - 1
.Col = A
.CellForeColor = vbBlack
.CellBackColor = vbWhite
.Col = 6
Next A
‘ al llegar a la ultima celda si es numero se active el boton de lo contrario queda desactivado
ElseIf .Row = .Rows - 1 Then
For v = 1 To .Rows - 1
If IsNumeric(.TextMatrix(v, 6)) Then
.Row = v
cmd_aceptar.Enabled = True
Else
cmd_aceptar.Enabled = false
End If
Next v
End If
Next Z
End If
End With
End Select
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder