Thread: perpetual dates
View Single Post
  #1   Report Post  
Dave Peterson
 
Posts: n/a
Default perpetual dates

Maybe...

Option Explicit
Sub auto_open()
Dim LastCell As Range
With Worksheets("Sheet1")
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If LastCell.Value = Date Then
'already opened and populated
'do nothing
Else
With LastCell.Offset(1, 0)
.Value = Date
.NumberFormat = "mm/dd/yyyy"
End With
End If
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

(I have no idea about the query, though.)

willray wrote:

Is there a way to have excel automatically add a new date to the end of a
column each day? My goal is to have an automatic date in column A and daily
closing prices for the S&P500(in column B) corresponding to those dates that
are updated via web query. Thanks so much!


--

Dave Peterson