dushyantgupta111
New Member
- Joined
- Sep 16, 2015
- Messages
- 4
Hi,
I have been trying to extract only numbers in the next row.
actual result as follow:
The result I want is
<tbody>
</tbody>
While the code works as:
<colgroup><col><col></colgroup><tbody>
</tbody>
I have been trying to extract only numbers in the next row.
actual result as follow:
The result I want is
abc125 | 125 |
bcd121 | 121 |
111aaa | 111 |
<tbody>
</tbody>
While the code works as:
abc125 | 125 |
bcd121 | 125121 |
111aaa | 125121111 |
<colgroup><col><col></colgroup><tbody>
</tbody>
Code:
Sub onlynumm()
Dim onlynum As String
Dim valuee As String
For Each cell In Selection
Dim res As String
Dim i As Integer
valuee = cell.Value
For i = 1 To Len(valuee)
If IsNumeric(Mid(valuee, i, 1)) = True Then
res = res + Mid(valuee, i, 1)
End If
Next
onlynum = res
cell.Offset(0, 1).Value = onlynum
Next
End Sub