Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 733
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 733
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
Calculate Date based on Time Mayte Excel Worksheet Functions 6 June 5th 08 09:07 PM
can a formula add color based on a date and time? Outbacker Excel Discussion (Misc queries) 1 August 29th 06 04:14 PM
How can I monitor CPU time of algorithm I developed in Excel vba? Jerry Excel Discussion (Misc queries) 2 August 27th 06 08:22 AM
Looking up a value based on date and time, what's wrong? Margo Guda Excel Worksheet Functions 3 February 28th 06 02:18 PM
change date based on time kdp145 Excel Discussion (Misc queries) 7 December 14th 05 02:05 AM


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