Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repost:I accidentally posted this in the general excel forum. Date Logic
I accidentally posted this in the general excel forum,,sorry
I have a date formula that I need to rewrite in VBA. Essentially i takes a date expressed in the format:m/d/yyyy h:mm, and then adds hour to it incrementally down rows. The first date is a constant, the secon date is the addition of one hour but the third date onward is a bi formula. Effectively the formula keeps adding hours but takes int account daylight savings in the months of april and october. I am not sure how to recreate this in VBA due to the brackets used i excel In excel it looks like this: A1 = 1/1/2002 0:00 B2 = a1+1/24 C2 =A2+1/ 24+IF(AND(MONTH(A2)=4,WEEKDAY(A2)=1,HOUR(A2)=1,EOM ONTH(A2,0)-A222),1 24,0)+IF(AND(MONTH(A2)=10,WEEKDAY(A2)=1,HOUR(A2)=1 ,HOUR(A1)=0,EOMONTH(A2,0)-A2<7),-1/24,0) In vba it looks like this: date1 = a1 = 1/1/2002 0:00 date2 = Serial(date1) + 1/24 'Is this correct? date3 = ?????????????? 'Recreate big formula Does anyone know how to do this -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 General Formating Unwanted Text to Date Conversion | Excel Discussion (Misc queries) | |||
MS Excel 2007 file default general is changed to date, very annoying, please help? | Excel Worksheet Functions | |||
repost from general area ref values with column to left HELP | Excel Worksheet Functions | |||
Accidentally converted date mm/dd/yy to a 5 digit number | Excel Worksheet Functions | |||
How to change date as general "200306" to date "06/2003" | Excel Discussion (Misc queries) |