I'm trying to devise a script that will find the next number after a text string then copy it. Currently I have a script that will do the job if the number occurs a predictable distance from the text string, but recently I've learned that the distance between the two may change randomly!
Here is an example of my text string:
COMPLETE BLOOD CNT/DIF/PLT
WHITE BLOOD CELL COUNT 7.2 K/UL (4.0- 11.0)
RED BLOOD CELL COUNT 3.19 L M/UL (4.00- 5.50)
HEMOGLOBIN 9.5 L G/DL (12.0- 16.0)
HEMATOCRIT 26.1 L % (37.0- 47.0)
MEAN CORPUSCULAR VOLUME 89 FL (82- 98)
MEAN CORPUSCULAR HGB 29.7 PG (27.0- 31.0)
Here is an example of my code:
Private Sub Command671_Click()
'Finds string in LabPaste.
Dim intWhere As String
intWhere = InStr(1, [LabPaste], "WHITE BLOOD CELL COUNT")
Text670.SelStart = intWhere - -50
Text670.SelLength = 4
I need it to find "WHITE BLOOD CELL COUNT" then copy "7.2"
Any help would be greatly appreciated!