cssfonseca
New Member
- Joined
- Aug 14, 2018
- Messages
- 19
Hello !
I need to know, in each cell in a range, if the last char of a cell is a number (the cell can contain text but i want to know only if the last char is a number), and if not, I want to show in a message box and highlight it.
I have written this code by adapting another code I have, and my attempt has been unsuccessful.
Can u help me? Where did I go wrong? Everywhere?
I need to know, in each cell in a range, if the last char of a cell is a number (the cell can contain text but i want to know only if the last char is a number), and if not, I want to show in a message box and highlight it.
I have written this code by adapting another code I have, and my attempt has been unsuccessful.
Code:
Sub verificarfinal()Dim c As Range
Dim Msg As String
For Each c In Range
If IsNumeric(Right(c, 1)) Then
Msg = Msg & vbTab & c.Address(RowAbsolute:=False, ColumnAbsolute:=False) & vbNewLine And c.Interior.ColorIndex = 3
End If
If Len(Msg) > 0 Then MsgBox "Verifique se as medidas estão conformes na(s) célula(s)" & vbNewLine & Msg
End If
Exit For
Next c
End Sub
Can u help me? Where did I go wrong? Everywhere?