Grabbing text from just part of a cell

  • Thread starter Thread starter Mary T
  • Start date Start date
M

Mary T

Hi all,

I have sheets that come in that include a cell that says, for instance
'Subject no.: 5'. How would I grab just the '5' part of that cell?

Help appreciated, thanks
 
The following function will grab whatever follows the colon space:

Function SubjectNum(InitialValue As String) As String

Dim l As Long

'Find the location of the colon and add 1 for the space
l = InStr(1, InitialValue, ":") + 1

SubjectNum = Right$(InitialValue, Len(InitialValue) - l)

End Function
 

Ask a Question

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.

Ask a Question

Back
Top