Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
Hi All
I need to create an algorithm based on time and date i.e =now(), and have this in a vba macro, so i can run it via a button I've never done an algorithm before, so i dont know how to begin The macro part i should be able to do ok Can anyone suggest a way to build a basic algorithm, or point me towards a url Thanks in advance P |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
An algorithm is a set of rules.
What do you want the algorithm to do??? -- Vasant "Phillip Torna." wrote in message ... Hi All, I need to create an algorithm based on time and date i.e =now(), and have this in a vba macro, so i can run it via a button. I've never done an algorithm before, so i dont know how to begin. The macro part i should be able to do ok. Can anyone suggest a way to build a basic algorithm, or point me towards a url? Thanks in advance. PT |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
I need it to produce a 22 digit unique number. (though i may need to be produce either smaller or larger numbers depending on the current projects needs.
As time and date are unique, i though an algorithm based on time & date would be able to provide this Cheers PT |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
You're limited to 15 digits with a floating point number,
so you will probably be wanting to construct a string with your unique ID. Dim UniqueID As String UniqueID="Q1234567" & Format(Date,"yyyymmdd") & Format (Time,"hhmmss") |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
Thank's Brad
I'll be able to construct something using your below example and some existing code Thanks. Very much appreciated ----- Brad Yundt wrote: ---- You're limited to 15 digits with a floating point number, so you will probably be wanting to construct a string with your unique ID Dim UniqueID As Strin UniqueID="Q1234567" & Format(Date,"yyyymmdd") & Forma (Time,"hhmmss" |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
"Phillip Torna" wrote...
I'll be able to construct something using your below example and some existing code. .... ----- Brad Yundt wrote: ----- .... UniqueID="Q1234567" & Format(Date,"yyyymmdd") & Format(Time,"hhmmss") If only one person would be using this, this would be OK. If multiple users could be using this at the same time, there's a nonnegligible chance your code could generate multiple instances of the exact same 'unique' key. There's only one reliable way to generate unique serial numbers: request them from a single, central source that keeps track of the last such value provided. No other approach is robust. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
"Bob Phillips" wrote...
GUIDs? .... Yes, for example. Banks and other high transaction count businesses also have localized batching of IDs, in which local servers receive a batch of IDs from a central machines. Those IDs are marked as distributed but not yet used until those local machines replicate with the central machine and transmit the IDs actually assigned. Depending on how many distributed but not yet assigned IDs there are on the local server, the central machine may or may not give the server another batch. What I'm getting at is that real time centralization isn't necessary, but eventual centralization during replication is necessary. Use the level of centralization or localization that works best. Just don't forget to replicate. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Algorithm based on time and date ( =Now() )
Hi Harlan
At present, it is intended for the workbook this is going into, only one person will be given access to at any given time I've been able to create a few algorithms/functions that will be used together to create a unique id, so this should greatly reduce any chance of a duplicate To ensure that only one person can use it at a time, i've created a little macro that checks to see if the workbook is currently open, and if so, it gives the user a little message, and closes the workbook. Plus, i've included as much protection as possible with-in excel Thanks for you input about the multi-users. It made me think that little bit more about generating non-unique id's Thanks PT. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate Date based on Time | Excel Worksheet Functions | |||
can a formula add color based on a date and time? | Excel Discussion (Misc queries) | |||
How can I monitor CPU time of algorithm I developed in Excel vba? | Excel Discussion (Misc queries) | |||
Looking up a value based on date and time, what's wrong? | Excel Worksheet Functions | |||
change date based on time | Excel Discussion (Misc queries) |