Find Max Alphanumeric Serial Number

Pinkster69

New Member
Joined
Jun 19, 2012
Messages
48
Hey Guys,

I am looking to find the Max Alphanumeric Serial Number that is in a column and increment by 1! I have code that finds the last "Sequential" serial number in the column and it increments by 1 but unfortunately all my Serial numbers are NOT Sequential in the column!
Can someone please look at my code to see what I have to add to find the Max Alphanumeric Serial Number from a list of NON Sequential Numbers and increment what is found by 1.

Many thanks



Example:
GR1020
GR0950
GR1080
GR1850
GR0760

Code:
Dim iRow As LongDim ws As Worksheet


    Set ws = Worksheets("Goods Return")
    
   
    'find last data row from database
    iRow = ws.Cells(Rows.Count, 3).End(xlUp).Row
 
    If ws.Range("C" & iRow).Value = "" Then
        GoodsReturnIDTB.Text = "GR1"
        
    Else
        GoodsReturnIDTB.Text = "GR" & Val(Mid(ws.Cells(iRow, 3).Value, 3)) + 1
       
    End If
 
like


Excel 2010
D
1GR6789
Sheet3
Cell Formulas
RangeFormula
D1{="GR"&MAX(MID(C1:C6,3,LEN(C1:C6)-2)*1)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Pinkster69,

Thanks for the feedback.

You are very welcome. Glad I could help.

And, come back anytime.
 
Upvote 0
Tried your code again! It worked!
Seems the Type Mismatch was due to my range which encompassed my heading!

Thanks again,

Have to say... U Da Man Too!!....
 
Upvote 0
Hey mikerickson!

Thanks for helping out, I got it sorted thanks to Hiker95 & Momentman,

I appreciate the effort alot

Cheers.
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top