# Question and need help

#### Ks1102

##### Well-known Member
Hi, pls help
Question If the range cells contents anything how would I just only get the value in that which number = 4 digi.
For example
Cells (1,1).value = (Wellington 0930 Mr.Roger )

Cells (2,2) = cells(1,1)……don’t know how to present the statement !!! Result = 0930

Do any idea?

### Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You could create your own function. Put this in a new module:

Code:
``````Option Explicit

Function GetNumber(rng As Range) As Double
Dim var As Variant
Dim l As Long
var = Split(rng, " ")
For l = LBound(var) To UBound(var)
If IsNumeric(var(l)) Then

GetNumber = var(l)
Exit Function

End If

Next l
End Function``````

Then use it like this on your worksheet =GetNumber(A1)

You could create your own function. Put this in a new module:

Code:
``````Option Explicit

Function GetNumber(rng As Range) As Double
Dim var As Variant
Dim l As Long
var = Split(rng, " ")
For l = LBound(var) To UBound(var)
If IsNumeric(var(l)) Then

GetNumber = var(l)
Exit Function

End If

Next l
End Function``````

Then use it like this on your worksheet =GetNumber(A1)

Thanks very much as it very imaging

Thanks very much as it very imaging

May i asked help again as Error below what i built for module as
Sub P()
Dim GetNumber As WorksheetFunction
For I = 1 To 13
Cells(I, 5) = WorksheetFunction.GetNumber.Cells(I, 4)
Next I
End Sub

Replies
6
Views
172
Replies
2
Views
458
Replies
5
Views
203
Replies
4
Views
141
Replies
2
Views
157

1,196,113
Messages
6,013,551
Members
441,770
Latest member
Griggsy28

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back