Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default subtract date and time between columns

Hi,
How can I create a macro that would calculate the difference in date and
time between 2 columns? I have column H and F with the cell format
"yyyy-mm-dd h:mm:ss". I like to have column F subtract column H to get the
date/time difference in the format "dd,h:mm:ss" and put the answer in column K

the macro keep on doing that until it reaches a blank line..

Thanks very much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default subtract date and time between columns

Hi Don

Why do you need a macro.
Just insert the formula in column K: =F1-H1
and format the cells in column K as "dd, hh:mm:ss"

regards
reklamo


"Don Doan" wrote:

Hi,
How can I create a macro that would calculate the difference in date and
time between 2 columns? I have column H and F with the cell format
"yyyy-mm-dd h:mm:ss". I like to have column F subtract column H to get the
date/time difference in the format "dd,h:mm:ss" and put the answer in column K

the macro keep on doing that until it reaches a blank line..

Thanks very much.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default subtract date and time between columns

Hi,
I need a macro to do that because I have many many workbooks that required
for such process..this way, if a macro is in placed, then i can just open the
workbook and run it

"reklamo" wrote:

Hi Don

Why do you need a macro.
Just insert the formula in column K: =F1-H1
and format the cells in column K as "dd, hh:mm:ss"

regards
reklamo


"Don Doan" wrote:

Hi,
How can I create a macro that would calculate the difference in date and
time between 2 columns? I have column H and F with the cell format
"yyyy-mm-dd h:mm:ss". I like to have column F subtract column H to get the
date/time difference in the format "dd,h:mm:ss" and put the answer in column K

the macro keep on doing that until it reaches a blank line..

Thanks very much.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default subtract date and time between columns

Hi Don

Lets say one date in is column F (column 6) and the other date in column H
(column 8) and you want to insert the difference in column K (column 11) and
you want to do this for row 1 to 13 then the macro could look like this:

Sub Macro1()
For i = 1 To 13
Cells(i, 11).Value = Cells(i, 6) - Cells(i, 8)
Cells(i, 11).NumberFormat = "dd, hh:mm:ss"
Next
End Sub

regards
reklamo


"Don Doan" wrote:

Hi,
I need a macro to do that because I have many many workbooks that required
for such process..this way, if a macro is in placed, then i can just open the
workbook and run it

"reklamo" wrote:

Hi Don

Why do you need a macro.
Just insert the formula in column K: =F1-H1
and format the cells in column K as "dd, hh:mm:ss"

regards
reklamo


"Don Doan" wrote:

Hi,
How can I create a macro that would calculate the difference in date and
time between 2 columns? I have column H and F with the cell format
"yyyy-mm-dd h:mm:ss". I like to have column F subtract column H to get the
date/time difference in the format "dd,h:mm:ss" and put the answer in column K

the macro keep on doing that until it reaches a blank line..

Thanks very much.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default subtract date and time between columns

hi there,
instead of using the for-next function, how do we use the do-loop function
so that it will keep on performing until it reaches a blank line?

"reklamo" wrote:

Hi Don

Lets say one date in is column F (column 6) and the other date in column H
(column 8) and you want to insert the difference in column K (column 11) and
you want to do this for row 1 to 13 then the macro could look like this:

Sub Macro1()
For i = 1 To 13
Cells(i, 11).Value = Cells(i, 6) - Cells(i, 8)
Cells(i, 11).NumberFormat = "dd, hh:mm:ss"
Next
End Sub

regards
reklamo


"Don Doan" wrote:

Hi,
I need a macro to do that because I have many many workbooks that required
for such process..this way, if a macro is in placed, then i can just open the
workbook and run it

"reklamo" wrote:

Hi Don

Why do you need a macro.
Just insert the formula in column K: =F1-H1
and format the cells in column K as "dd, hh:mm:ss"

regards
reklamo


"Don Doan" wrote:

Hi,
How can I create a macro that would calculate the difference in date and
time between 2 columns? I have column H and F with the cell format
"yyyy-mm-dd h:mm:ss". I like to have column F subtract column H to get the
date/time difference in the format "dd,h:mm:ss" and put the answer in column K

the macro keep on doing that until it reaches a blank line..

Thanks very much.



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
Subtract 12 hours from date/time Cindy Excel Discussion (Misc queries) 8 April 26th 23 07:46 PM
how do I subtract time from a date to get an earlier date? Sunny_Dreams Excel Discussion (Misc queries) 5 February 11th 09 05:58 PM
How do I subtract 8 business hours from a date/time value? drew Excel Discussion (Misc queries) 5 July 7th 08 02:33 PM
Time/Date subtract 24 hours ET902 Excel Discussion (Misc queries) 4 September 12th 06 02:47 PM
how can i subtract time from two different date? Manoo Excel Worksheet Functions 1 March 8th 05 04:00 AM


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