Hi,
When I print an invoice, the data of that invoice is saved on my dat
sheet, one line per invoice and many columns, one for each data of th
invoice. The first column being for the invoice number.
To get the next sequential number I find the last line used of the dat
sheet and it will be the value of the column A of that line plus one.
To find the last row use this formula from Ron De Bruin:
Sub test()
MsgBox LRow(ActiveSheet) + 1
End Sub
Function LRow(sh As Worksheet)
On Error Resume Next
LRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function
It is working great for that purpose.
Alai