Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-03-2017, 11:23 AM
srinivasaru srinivasaru is offline Creating alphanumeric incremental serial numbers Windows 8 Creating alphanumeric incremental serial numbers Office 2013
Novice
Creating alphanumeric incremental serial numbers
 
Join Date: Mar 2017
Posts: 10
srinivasaru is on a distinguished road
Default

Yes for sure, below is my code

<Code>
Str = tRangeShort + Right(Year(dtDate.Value), 2) + Month(dtDate.Value)
txtDocNo.Text = GetIncrementalSerialNumber(NewRange, Str)

Private Function GetIncrementalSerialNumber(inRange As Range, sStr As String) As String
Dim StrSrch As String, tSerial As String, tNo As String
Dim tDigit As Integer, i As Integer
Dim tpRange As Range

StrSrch = sStr & "*" 'Concatenate an (*) at the end of the string
tSerial = ""
tNo = 0

For Each tpRange In inRange
If tpRange.Value Like StrSrch Then
tNo = tNo + 1 'Counter to find the number of exact matches
End If
Next tpRange
tNo = tNo + 1 'Adding 1 to total number of exact matches available

tDigit = 3 - Len(tNo) 'Find the length of the counter to prefix 0s
For i = 1 To tDigit
tSerial = "0" & tSerial 'Prefix 0s as required
Next i

GetIncrementalSerialNumber = sStr & tSerial & tNo 'Concatenate all
End Sub
<\Code>
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Excel have created a shop transfer note, these need to have individual rolling serial numbers nette74 Excel Programming 0 05-02-2015 02:48 AM
Creating alphanumeric incremental serial numbers incremental printing in ms word little snyder Word VBA 4 11-23-2013 05:19 AM
Creating alphanumeric incremental serial numbers Sorting Alphanumeric & Numeric values slovenc0417 Excel 2 06-07-2013 07:58 PM
Creating alphanumeric incremental serial numbers Creating styles in Word - alphanumeric lists jmichellephd Word 8 03-25-2013 12:14 AM
Creating alphanumeric incremental serial numbers Extract Numbers from Alphanumeric String OTPM Excel 6 05-13-2011 12:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft