Hi excelforum user´s!
I need help.. I have a macro wiht values in column (D9: D), but I need one macro to tell me if there are different values to the value "PZ" and "MT".
Because sometimes added values as "Pzz" "mt", "MTT" etc. .. and that's a mistake on many lists I make ..
In case there are different values that the red mark (and I have that step, I just do not respect the range D9, and mark cells D1 to D8)..
Best Regards!!
'Seleccionar de color los datos no válidos
Dim rnArea As range
Dim rnCell As range
Set rnArea = Sheets("sheet2").range("D9", range("D65536").End(xlUp))
Sheets("sheet2").range("D:D").Interior.ColorIndex = 3
For Each rnCell In rnArea
With rnCell
If Not IsError(.Value) Then
Select Case .Value
Case ""
.Interior.ColorIndex = 3
Case Is = "PZ"
.Interior.ColorIndex = xlNone
Case Is = "MT"
.Interior.ColorIndex = xlNone
End Select
End If
End With
Next
'Indicar datos vacios o datos no válidos
Dim i As Long
Dim j As Long
On Error Resume Next
i = range("D9:D" & range("D" & Rows.Count).End(xlUp).Row) _
.SpecialCells(xlCellTypeBlanks).Count
j = range("D9:D" & range("D" & Rows.Count).End(xlUp).Row) _
.SpecialCells(xlCellTypeFormulas, xlErrors).Count
If i > 0 Then
MsgBox "Tienes " & i & " items sin tipo de Pieza (PZ,MT)" & vbCr & _
"Favor de solucionar los valores de UOM (D)", vbOKOnly, "Espacios Vacios.."
End If
If j > 0 Then
MsgBox "Tienes " & j & " valores no válidos " & vbCr & _
"Favor de solucionar los valores de UOM (D)", vbOKOnly, "Valores no válidos"
End If
Bookmarks