Beruflich Dokumente
Kultur Dokumente
Range("Tabla1").Select
Selection.ClearContents
Range("Tabla1").ClearContents
End Sub
lRowA = Range("A1").End(xlDown).Row
'lRowB = Range("B1").End(xlDown).Row
'lRowC = Range("C1").End(xlDown).Row
Dim arr(1 To 1, 1 To 2)
arr(1, 1) = lRowA
arr(1, 2) = 1
'arr(2, 1) = lRowB
'arr(2, 2) = 2
'arr(3, 1) = lRowC
'arr(3, 2) = 3
'arr(4, 1) = lRowA
'arr(4, 2) = 4
msgerr = False
flag = False
'For i = 1 To 3
' If arr(i, 1) > 1001 Then
' msgerr = True
' error = True
'flag = True
'err_cnt = err_cnt + 1
'End If
'If arr(i, 1) <> arr(i + 1, 1) Then
'error = True
'flag = True
'err_cnt = err_cnt + 1
'End If
'Next i
Dim m, k As Integer
Dim spchar(1 To 25) As String
Dim strval As String
spchar(1) = "ñ"
spchar(2) = "á"
spchar(3) = "í"
spchar(4) = "ó"
spchar(5) = "ú"
spchar(6) = "/"
spchar(7) = "*"
spchar(8) = "^"
spchar(9) = "#"
spchar(10) = "$"
spchar(11) = "%"
spchar(12) = "&"
spchar(13) = "?"
spchar(14) = "'"
spchar(15) = "¿"
spchar(16) = "¡"
spchar(17) = "|"
spchar(18) = "°"
spchar(19) = "¬"
spchar(20) = ","
spchar(21) = "}"
spchar(22) = "{"
spchar(23) = "["
spchar(24) = "]"
spchar(25) = "\"
For k = 2 To lRowA
For m = 1 To 25
strval = LCase(Cells(k, 1).Value)
err_char = InStr(strval, spchar(m))
If err_char <= 0 And Cells(k, 1).Interior.ColorIndex = 22 Then
Cells(k, 1).Interior.ColorIndex = 2
End If
Next m
Next k
'Campos vacíoS
If flag Then
For j = 1 To lRowA
If arr(j, 1) > gtnum Then
gtnum = arr(j, 1)
End If
Next j
For j = 1 To 3
If arr(j, 1) < gtnum Then
diffT = gtnum - arr(j, 1)
For a = arr(j, 1) To arr(j, 1) + diffT
If Cells(a, arr(j, 2)).Value = "" Then
error = True
err_cnt = err_cnt + 1
Cells(a, arr(j, 2)).Interior.ColorIndex = 22
err_str = err_str & " " & Split(Cells(1, arr(j, 2)).Address(True,
False), "$")(0) & a & " "
End If
Next a
End If
Next j
End If
For i = 2 To gtnum
If Cells(i, 1).Value = "" Then
Cells(i, 1).Interior.ColorIndex = 22
err_str = err_str & "A" & i & " "
err_cnt = err_cnt + 1
Else
Cells(i, 1).Interior.ColorIndex = 2
End If
If Cells(i, 2).Value = "" Then
Cells(i, 2).Interior.ColorIndex = 22
err_str = err_str & "B" & i & " "
err_cnt = err_cnt + 1
Else
If IsNumeric(Cells(i, 2).Value) Then
Cells(i, 2).Interior.ColorIndex = 2
Else
Cells(i, 2).Interior.ColorIndex = 22
err_str = err_str & "B" & i & " "
err_cnt = err_cnt + 1
End If
End If
If Cells(i, 3).Value = "" Then
Cells(i, 3).Interior.ColorIndex = 22
err_str = err_str & "C" & i & " "
err_cnt = err_cnt + 1
Else
If IsNumeric(Cells(i, 3).Value) Then
Cells(i, 3).Interior.ColorIndex = 2
Else
Cells(i, 3).Interior.ColorIndex = 22
err_str = err_str & "C" & i & " "
err_cnt = err_cnt + 1
End If
End If
Next i
'Validar formato de TD
Dim str1 As String
For i = 2 To lRowA
str1 = Split(Cells(i, 1).Value, ".")(0)
str2 = Split(Cells(i, 1).Value, ".")(1)
For k = 2 To lRowA
For l = 1 To 3
For m = 1 To 25
Cells(k, l) = Replace(Cells(k, l).Value, ",", "")
Cells(k, l) = Replace(Cells(k, l).Value, " ", "")
strval = LCase(Cells(k, l).Value)
err_char = InStr(strval, spchar(m))
If err_char > 0 Then
Cells(k, l) = Replace(Cells(k, l).Value, ",", "")
Cells(k, l).Interior.ColorIndex = 22
error = True
err_cnt = err_cnt + 1
err_str = err_str & " " & Split(Cells(1, l).Address(True, False),
"$")(0) & k & " "
End If
Next m
Next l
Next k
Cancel = error
Exit Sub
ErrorHandler:
MsgBox "No puede dejar la columna vacía"
Cancel = True
End Sub
min = gtnum
End Function