Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default loop to time in 24 hours format

Hi
I want to make a loop in time format

like from 9:00 to 16:00
and with every half hour like
9:00 - 9:30 - -10:00 - 10:30
can i do that ?

Regards alvin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default loop to time in 24 hours format

Hi Alvin,

Could do that very easily manually -

A1: 09:00
A2: 10:00
select A1:A2
grab the little handle and drag down to A14
B2: =TEXT(A1,"hh.mm -") & TEXT(A2,"hh.mm")
double click the handle to fill down

maybe you prefer "h.mm" format

Or do you particularly need a VBA solution?

Regards,
Peter T

"Alvin Hansen" wrote in message
...
Hi
I want to make a loop in time format

like from 9:00 to 16:00
and with every half hour like
9:00 - 9:30 - -10:00 - 10:30
can i do that ?

Regards alvin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default loop to time in 24 hours format

Alvin Hansen wrote:
Hi
I want to make a loop in time format

like from 9:00 to 16:00
and with every half hour like
9:00 - 9:30 - -10:00 - 10:30
can i do that ?

Regards alvin

Make a sub in ThisWorkbook with:

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:30:00"), "RunThisSub"
End Sub


Create a module with:

Public dTime As Date
Sub RunThisSub()
dTime = Now + TimeValue("00:30:00")
Application.OnTime dTime, "RunThisSub"

If Time < "09:00:00" or Time "16:00:00" then exit sub

'Put your code here

End Sub


This wil run every half hour but wil exit if not between 9 and 16 hours
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default loop to time in 24 hours format

You mean something like this:
Sub Tester1()
Dim i As Single
For i = #9:00:00 AM# To #4:00:00 PM# Step #12:30:00 AM#
Debug.Print Format(i, "hh:mm:ss")
Next
End Sub


--
Regards,
Tom Ogilvy

"Alvin Hansen" wrote in message
...
Hi
I want to make a loop in time format

like from 9:00 to 16:00
and with every half hour like
9:00 - 9:30 - -10:00 - 10:30
can i do that ?

Regards alvin



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default loop to time in 24 hours format

Seeing Warzel's adjacent post, I realize I completely misunderstood the
question. Ignore my suggestion.

Peter T

"Peter T" <peter_t@discussions wrote in message
...
Hi Alvin,

Could do that very easily manually -

A1: 09:00
A2: 10:00
select A1:A2
grab the little handle and drag down to A14
B2: =TEXT(A1,"hh.mm -") & TEXT(A2,"hh.mm")
double click the handle to fill down

maybe you prefer "h.mm" format

Or do you particularly need a VBA solution?

Regards,
Peter T

"Alvin Hansen" wrote in message
...
Hi
I want to make a loop in time format

like from 9:00 to 16:00
and with every half hour like
9:00 - 9:30 - -10:00 - 10:30
can i do that ?

Regards alvin







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default loop to time in 24 hours format

Thanks again for the help

alvin

"Tom Ogilvy" skrev:

You mean something like this:
Sub Tester1()
Dim i As Single
For i = #9:00:00 AM# To #4:00:00 PM# Step #12:30:00 AM#
Debug.Print Format(i, "hh:mm:ss")
Next
End Sub


--
Regards,
Tom Ogilvy

"Alvin Hansen" wrote in message
...
Hi
I want to make a loop in time format

like from 9:00 to 16:00
and with every half hour like
9:00 - 9:30 - -10:00 - 10:30
can i do that ?

Regards alvin




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
Adding time in 24 hour format to produce hours in decimal format Hercdriver Excel Worksheet Functions 11 December 29th 09 02:06 AM
+24 hours time format Georges Heinesch New Users to Excel 2 February 9th 09 12:48 PM
HOW TO CONVERT TIME FORMAT IN HOURS TO MINUTES Eclaires Excel Worksheet Functions 2 July 9th 07 03:48 PM
Convert hours and minutes in time format into fractions of hours.. Akern Excel Worksheet Functions 4 April 21st 05 02:56 PM
time format multiplied by hours worked ? Brett Excel Worksheet Functions 2 January 11th 05 01:11 AM


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