![]() |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com