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
[TABLE="width: 134"]
<tbody>[TR]
[TD]
abc125
[/TD]
[TD="align: right"]125
[/TD]
[/TR]
[TR]
[TD]bcd121
[/TD]
[TD="align: right"]121
[/TD]
[/TR]
[TR]
[TD]111aaa
[/TD]
[TD="align: right"]111
[/TD]
[/TR]
</tbody>[/TABLE]
While the code works as:
[TABLE="width: 134"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]abc125
[/TD]
[TD="align: right"]125
[/TD]
[/TR]
[TR]
[TD]bcd121
[/TD]
[TD="align: right"]125121[/TD]
[/TR]
[TR]
[TD]111aaa
[/TD]
[TD="align: right"]125121111[/TD]
[/TR]
</tbody>[/TABLE]
I have been trying to extract only numbers in the next row.
actual result as follow:
The result I want is
[TABLE="width: 134"]
<tbody>[TR]
[TD]
abc125
[/TD]
[TD="align: right"]125
[/TD]
[/TR]
[TR]
[TD]bcd121
[/TD]
[TD="align: right"]121
[/TD]
[/TR]
[TR]
[TD]111aaa
[/TD]
[TD="align: right"]111
[/TD]
[/TR]
</tbody>[/TABLE]
While the code works as:
[TABLE="width: 134"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]abc125
[/TD]
[TD="align: right"]125
[/TD]
[/TR]
[TR]
[TD]bcd121
[/TD]
[TD="align: right"]125121[/TD]
[/TR]
[TR]
[TD]111aaa
[/TD]
[TD="align: right"]125121111[/TD]
[/TR]
</tbody>[/TABLE]
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