LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Loop through date range, but skip down to next year


Okay so the title is stupid, but I don't know how to explain in just a few
words my issue.

We have a range of dates in Column A
Jan 1973
Feb 1973
....
Apr 2009

I am trying to pull numbers from a website that correspond to totals for
each month, but the website (
http://tonto.eia.doe.gov/dnav/ng/hist/n9132cn2m.htm) only lists the years,
and then each line below it corresponds to a total for each month in that
year. Here is an example of the source for year 1973:

<tr
<td class='B4' 1973</td
<td class='B3'60</td
<td class='B3'384</td
<td class='B3'1,167</td
<td class='B3'931</td
<td class='B3'1,670</td
<td class='B3'1,598</td
<td class='B3'1,758</td
<td class='B3'1,829</td
<td class='B3'1,022</td
<td class='B3'1,465</td
<td class='B3'1,483</td
<td class='B3'1,456</td
</tr

I used the following code to test getting the January total for each year,
but how can I set my loop to skip down 12 cells to the next year? Currently
it is putting the January value in each cell for each year

Set rng = Range("A2").CurrentRegion
Set rng = rng.Resize(rng.Rows.Count, 1)

For Each c In rng
sURLdate = Format(c.Value2, "yyyy")
c.Offset(0, 1).Value = RegexMid(myStr, sURLdate, "class=b3")
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a date range contains a leap year (date) Rebecca_SUNY Excel Worksheet Functions 14 July 5th 08 11:46 AM
Date - I would like to skip weekends in a date range Teethless mama Excel Worksheet Functions 0 April 1st 08 12:56 AM
Locate month n year from range of date Rao Ratan Singh New Users to Excel 1 March 2nd 06 09:13 AM
Query on Date range does not qualify the Year Malcolm Makin[_2_] Excel Programming 5 June 23rd 05 07:00 PM
Excel VBA macro - need to edit code to skip a year adun3434 Excel Programming 0 April 1st 04 09:14 PM


All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"