Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding a row on Open


Hi everyone,

This might seem trivial to many but I don't seem to understand it why I
am having trouble with this. I have the following code


Code:
--------------------
Private Sub Workbook_Open()
Private Sub Workbook_Open()
Dim Today As String
Today = "=Today()"

With Worksheets(4)
If .Cells(4, 1).Value < Today Then
Rows("4:4").Insert Shift:=xlDown
.Cells(4, 1) = Today
End If
End With
End Sub

--------------------


As you can see, I want to compare a cell with today's date. If it's
not today's date, then add a new row (since data will be added). The
code looks correct to me, but I don't doubt something is wrong since it
obviously is not working properly. Everytime I open the workbook, it
adds a new row regardless whether cell A4 has today's date or not.
Does anyone have any insight as to what may be going on?

Thanks in advance.

-- Isaac


--
I Maycotte
------------------------------------------------------------------------
I Maycotte's Profile: http://www.excelforum.com/member.php...o&userid=35604
View this thread: http://www.excelforum.com/showthread...hreadid=557835

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
ON OPEN VBA Code input incorrectly now excel sheet wont open mmartin New Users to Excel 1 February 16th 11 11:33 PM
Adding new folders for "Look In:" when selecting File - Open Big UT Fan Excel Discussion (Misc queries) 10 January 29th 10 09:50 PM
Adding a copy of an open window to an excel worksheet Jane Excel Worksheet Functions 3 November 30th 09 04:38 PM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. san Excel Programming 1 January 3rd 06 03:22 AM


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

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

About Us

"It's about Microsoft Excel"