I'm not entirely clear on the meaning of "fix" and "select" as you used them
in your question. This formula...
=RIGHT(J2,4)
will return up to the right-most 4 characters (that is, from zero to four
characters depending on the cell's content) in a cell (J2 for the above
example usage) and can be copied down to handle the other cells in the
column. Is that what you are looking for?
LastRow = Cells(Rows.Count, "J").End(xlUp).Row
For RowCount = 2 To LastRow
data = Trim(Range("J" & RowCount))
'get last four didgits of text
If Len(data) >= 4 Then
data = Trim(Right(data, 4))
End If
'convert to number if necessary
'comment out if not necessary
If IsNumeric(data) Then
Number = Val(data)
End If
Range("J" & RowCount) = Number
Next RowCount
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.