Validación con VBA hacia las celdas
Publicado por Luis García (1 intervención) el 29/05/2003 01:09:17
Que Tal? Disculpen la molestia, lo que pasa es que este código me marca un error y al parecer funciona bien, funciona una vez, y no vuelve a funcionar más, les agradecería mucho que pudieran ayudarme, de antemano gracias.
Dim gStrDato As String
Sub Macro5()
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=gStrDato
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sIntJ As Integer
If Target.Column = 8 Then
If Cells(Target.Row, Target.Column) <> "" Then
If IsArray(Target.Value) Then
For sIntJ = 0 To Target.Rows.Count
Call VerificaValor(Target.Row + sIntJ, Target.Column)
Next sIntJ
Else
Call VerificaValor(Target.Row, Target.Column)
End If
End If
End If
End Sub
Private Sub VerificaValor(pIntFila As Long, pIntColumna As Long)
Dim sIntI As Integer, sStrFormula As String
If Cells(pIntFila, pIntColumna) = "" Then
Cells(pIntFila, pIntColumna) = ""
Else
For sIntI = 1 To Cells(1, "AA") %
Dim gStrDato As String
Sub Macro5()
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=gStrDato
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sIntJ As Integer
If Target.Column = 8 Then
If Cells(Target.Row, Target.Column) <> "" Then
If IsArray(Target.Value) Then
For sIntJ = 0 To Target.Rows.Count
Call VerificaValor(Target.Row + sIntJ, Target.Column)
Next sIntJ
Else
Call VerificaValor(Target.Row, Target.Column)
End If
End If
End If
End Sub
Private Sub VerificaValor(pIntFila As Long, pIntColumna As Long)
Dim sIntI As Integer, sStrFormula As String
If Cells(pIntFila, pIntColumna) = "" Then
Cells(pIntFila, pIntColumna) = ""
Else
For sIntI = 1 To Cells(1, "AA") %
Valora esta pregunta


0