Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 3rd, 2007, 10:07 AM
Authorized User
 
Join Date: Apr 2007
Location: Silvassa, Dadra & Nagar Haveli, India.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Product code generator

Need some formula to generate a 13 digit code for the products.

Yogesh
__________________
Yogesh
Reply With Quote
  #2 (permalink)  
Old October 3rd, 2007, 10:50 AM
Friend of Wrox
Points: 513, Level: 8
Points: 513, Level: 8 Points: 513, Level: 8 Points: 513, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Davenport, IA, USA.
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Should the code contain just numbers? Just Letters? A mixture? Are the first few letters and the last few numbers? Is the code completely random? Are duplicate codes acceptable?

There isn't very much information to go on to generate a solution for.

If you just want a random set of numbers extended to 13 digits, then this would work:
----------------------------------------------------
Dim iCnt As Integer, sCode As String
For iCnt = 1 to 13
  sCode = sCode & Int((Rnd * 10)) 'Concatenates random number between 0 and 9
Next
MsgBox "The generated code is: " & sCode
----------------------------------------------------

The above doesn't check to see if there was a duplicate. You'd have to check the result against a list for that.
If you are looking for anything more specific then more information on what is desired is needed.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code generator and some other things Hyzac BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 13 October 9th, 2006 02:06 PM
The best code documentation generator for .VS 2005 woojtii C# 2005 1 July 3rd, 2006 01:17 PM
XSLT code generator for C# asap XSLT 0 April 14th, 2006 03:54 PM
Product Activation Code (Urgent) madhanagopal Pro VB.NET 2002/2003 5 September 6th, 2004 04:54 AM
XML Development Environment and code generator ptesone XML 0 December 22nd, 2003 10:14 AM



All times are GMT -4. The time now is 06:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.