#1   Report Post  
willray
 
Posts: n/a
Default perpetual dates

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!
  #2   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
Reply
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
Calculating number of days between two dates that fall between two other dates [email protected] Excel Discussion (Misc queries) 5 October 26th 05 06:18 PM
Automatic shading of cells based on dates??? Pedros Excel Worksheet Functions 3 October 20th 05 12:35 AM
2 digit year in dates return 19xx not 20xx moranbo Excel Discussion (Misc queries) 1 September 7th 05 01:44 AM
Default Dates Sue Excel Discussion (Misc queries) 1 July 22nd 05 12:29 PM
Formating Dates for production schedule dpl7579 Excel Discussion (Misc queries) 1 January 11th 05 08:43 PM


All times are GMT +1. The time now is 09:53 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"