If I understand your comment correctly, you have a bunch of XML as a string. That is, something like this in one cell of a worksheet:
<p id="name">Rahul</P> <p id="job">ABC Corp</P> <p id="empid">12345</p> <p id="age">30</p>
Now, you should never use regular expressions to parse HTML or XML. That said, let's use regular expressions! Under Tools | References, add a reference to Microsoft VBScript Regular Expressions 5.5
.
Option Explicit
Option Base 0
Public Sub EmpID()
Dim re As VBScript_RegExp_55.RegExp
Set re = New VBScript_RegExp_55.RegExp
re.Pattern = "empid""\s*>\s*([0-9]+)"
' A pattern that matches the end of the empid tag
' and the following numerical empid value.
Dim matches As VBScript_RegExp_55.MatchCollection
Dim match As VBScript_RegExp_55.match
Set matches = re.Execute(ActiveSheet.Range("A1"))
' Or whatever text you want ^^^^^^^^^^^^^^^^
For Each match In matches
Debug.Print match.SubMatches(0) ' The number
' Or whatever you want to do with it
Next match
End Sub
On my Excel 2013, this outputs 12345
to the debug console, using the input above.