Вот код, который должен сделать трюк. Я предположил, что вы не рассматриваете $ как числовое значение в этом.
Sub AddZero()
Dim wb As Workbook, ws As Worksheet, rng As Range
Dim chkBool As Boolean, char3 As String, char2 As String, char1 As String
Set wb = ThisWorkbook 'change this to suit your workbook
Set ws = wb.Worksheets("Sheet1") 'change this to suit your sheet
Set rng = ws.Range("B:B") 'change this to suit your range
For Each Cell In rng
If IsEmpty(Cell.Value) Then
Set rng = Nothing
Set ws = Nothing
Set wb = Nothing
Exit Sub 'I have assumed that there will not be blank rows in the range
End If
'''''' start checking the numbers at the end of the string
char3 = Mid(Cell.Value, Len(Cell.Value), 1)
char2 = Mid(Cell.Value, Len(Cell.Value) - 1, 1)
char1 = Mid(Cell.Value, Len(Cell.Value) - 2, 1)
If IsNumeric(char3) And char3 <> "$" Then 'isnumeric check the next character
If IsNumeric(char2) And char2 <> "$" Then
If IsNumeric(char1) And char1 <> "$" Then
chkBool = True
End If
If chkBool = False Then
Cell.Value = Mid(Cell.Value, 1, Len(Cell.Value) - 2) & "0" & char2 & char3 'reform the cell value
End If
chkBool = False 'reset the check if there is already 3 numbers at the end of the string
Else:
Cell.Value = Mid(Cell.Value, 1, Len(Cell.Value) - 1) & "00" & char3
End If
Else:
'Cell.Value = Mid(Cell.Value, 1, Len(Cell.Value) - 2) & "000" 'not sure if you need this but if no numbers found will mask the end with 000
End If
Next Cell
Set rng = Nothing
Set ws = Nothing
Set wb = Nothing
End Sub
Я думаю, что ответ Дика лучше, если вы можете использовать разделитель, если ваш разделитель не всегда или отличаются, то мой будет работать лучше, это действительно зависит от вашей ситуации.
Вы просите нас написать или помочь вам с тем, что вы уже написали? Что вы пробовали? –