Hi all. I'm trying to increment a variable NextDay (of type date) +1 every time through a loop. With each pass, the NextDay variable gets passed to a string, to be the address of a web query. So. I need to change the format I'm getting (3/19/09) to ("yyyymmdd") but I'm not sure of the syntax. Thanks in advance.
Code:
Dim NextDay As Date 'The variable that holds the date being checked
Dim NextDayString As String 'The web address that holds the variable to change the date. Passed to the query in the loop.
Dim EA As Worksheet 'Earnings worksheet
Dim i As Integer 'loop counter
For i = 1 To 30 'Loop counter, get each date and data with each pass.
'Format desired (needed for string address is Format("yyyymmdd")
NextDay = Date + i
'Yahoo address: [URL]http://biz.yahoo.com/research/earncal/20090320.html[/URL] (includes date of March 20, 2009)
NextDayString = "[URL]http://biz.yahoo.com/research/earncal/[/URL]" & NextDay & ".html"
MsgBox NextDayString
Next i