View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
FabZ FabZ is offline
external usenet poster
 
Posts: 4
Default Extract text plus "n" characters or date on partial match

Hi everybody,

Here there are two string samples of my cells in columnA:

der. husky b/n f 4 aa. rmd 2161 huma - p.p. adopted 10.02.04
dobermann n/f m. steril+rmd24378 faruk - p.p. trasf. palombara 13/1/05


I need to extract:

rmd 2161
rmd24378

and I started from function extracteMailAddress() found on this
newsgroup

Sub extractTattoo()

sstr = Range("A4").Text

sstr = ActiveCell.Text

p = InStr(1, sstr, "rm") - 1
Do While char < " " And p 0
char = Mid(sstr, p, 1)
Debug.Print "'" & char & "'"
p = p - 1
Loop

'Get tattoo address
If p 0 Then
p = p + 1
tattoo = Mid(sstr, p, 9)
ActiveCell.Offset(0, 9).Value = tattoo

Debug.Print tatuaggio
End If
End Sub

On some cell it works, but, really, I can't say this code works and
anyway I tried also to make it work on all the column range with no
results ...

Maybe starting from the same code I need to extract dates, first,
looking for partial text match(for ex. looking for "adopted" or "-
adop." or "ado." with "*ado*") and then fill one of two cells in
different columns on the same row, always, formatting date with "dd/mm/
yyyy".

I think I need help, I'm a newbie and these codes are just a little
bit hard for my actual knowledges...
Any help would be really appreciated!
Thanks
FabZ