Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Excel 2007 General Formating Unwanted Text to Date Conversion RRTRACKS77 Excel Discussion (Misc queries) 5 December 17th 08 07:14 AM
MS Excel 2007 file default general is changed to date, very annoying, please help? [email protected] Excel Worksheet Functions 0 March 21st 07 06:52 PM
repost from general area ref values with column to left HELP learningasigo Excel Worksheet Functions 1 June 25th 06 06:55 AM
Accidentally converted date mm/dd/yy to a 5 digit number Eve Excel Worksheet Functions 6 August 3rd 05 01:46 PM
How to change date as general "200306" to date "06/2003" Delwyn Excel Discussion (Misc queries) 1 June 15th 05 03:24 AM


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