Invoice numbering?

ljubo_gr

Active Member
Joined
Dec 6, 2014
Messages
251
Office Version
  1. 2013
Platform
  1. Windows
Please, dear Excel super master users.
I have three(1.2.3) sheets, columns A and B on all three. In column B should be invoice number generated inserting data in A column, like, when typing "Bill" in A1, that should result MRE-INV-01 in B1. BUT, when typing "Jelen" in A1 on Sheet2, should be MRE-INV-02. and so on.
Invoice numbering should be generated by vlookup, Sheet1 to vlookup on sheet2&3, Sheet2 to vlookup sheet1&3... Then, probably IF function,,,, i don't know:confused:
 
And MAX not working showing only counted numbers(1,2,3,4,..). And i made mistake, invoice numbers should start like: INV-1-16, INV-2-16....

Right click on C1 and change the cell format. But now you want a different invoice format, so I will tell you what to change C1 format to once I figure out what you want.

I don't follow this; INV-1-16, INV-2-16
Explain.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
INVOICE-NUMBER-YEAR (INV-1-16, INV-2-16, INV-3-16....)
MAX is Ok. i just added "INV-"&MAX&"-16"
I didn't try. So UNDO is Ok for other columns?
 
Last edited:
Upvote 0
.NumberFormat = """INV-""0" "-""16"""

Oh, how?? maybe """INV-""0" &""-""&""16"":confused:
 
Last edited:
Upvote 0
Actually, UNDO is Ok except A&B columns. But that's all right.
I need something even worse: INV-0/16, yes, forward-slash mark.
 
Upvote 0
.NumberFormat = """INV-""0""/Moi""" This is working! Problem is in number 16!
i cannot add 16 to: Sheets("Sheet3").Range("B:B")) + 1 & ""/16""
 
Last edited:
Upvote 0
I found a solution: """INV-""0""/16""" THANK YOU ALL!
THANK YOU AlphaFrog, Bill Jelen, Michael Girvin, Bill Szysz..... :laugh:
 
Last edited:
Upvote 0
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Sh.Name = "Sheet1" Or Sh.Name = "Sheet2" Or Sh.Name = "Sheet3" Then
        If Target.Count = 1 Then
            If Target.Value <> "" Then
                If Target.Column = 1 Then
                    With Target.Offset(, 1)
                        .Value = Application.Max(Sheets("Sheet1").Range("B:B"), _
                                                 Sheets("Sheet2").Range("B:B"), _
                                                 Sheets("Sheet3").Range("B:B")) + 1
                        .NumberFormat = """INV-""439""/16"""
                    End With
                ElseIf Target.Column = 2 Then
                    If Application.CountIf(Sheets("Sheet1").Range("B:B"), Target) + _
                       Application.CountIf(Sheets("Sheet2").Range("B:B"), Target) + _
                       Application.CountIf(Sheets("Sheet3").Range("B:B"), Target) > 1 Then
                            MsgBox "Duplicate Invoice Number", vbExclamation, "Invalid Entry"
                            Target.ClearContents
                    End If
                End If
            End If
        End If
    End If
End Sub

This, eventually, is not working. Today is April, and i need to start from No 439 ("""INV-""439""/16"""). When i run code, it skips 439 and go on 441 ...449 and then 4410. I'm not the expert, but AlphaFrog code is probably based just on counting rows. :(
 
Last edited:
Upvote 0
NO NO , i'm so sorry! It's working, ME DUMB!I just need enter manually first month entry(SalesNorth _ INV-439/16), and code work just fine!
I'm sorry & THANK YOU!
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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