View Single Post
  #30   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Parse HMTL source to fill in cells?


On Wed, 1 Jul 2009 07:58:14 -0700, Jason
wrote:

Okay, I'll tinker with the range and hopefully get it to work. I believe the
problem lies in some blank cells above the data where the header and title
information are located.

I've already managed to use the code to get ideas for other tasks and had
one final question in regards to Reg Exp syntax.

I modified the Pattern you included in the original code to grab a number
from a different site.

re.Pattern = "\b" & "nbsp;" & sYear & "[\s\S]+?" & sMonthTotal & "\D+(\d+)"

Where the sMonthTotal is a monthly total number

However the number includes commas and so the modified pattern only grabs
the numbers before the first comma.
Example:
-The number is 13,456,876 then the next line is 457,754
-The code grabs 13 and 457 for the next one

Thanks again! I am working with it and have no doubt I will benefit greatly
from your expertise.


I have not tested this, but you might try using "[\d,]+" in place of the "\d".
It is not as robust as a regex that looks for proper comma placement, but after
an adult beverage, it might be good enough.
--ron