J
Jason
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")
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")