To: Richie(UK)
Here is a sample of the many macros I use in the project, for the reduction of the "Select &/or Activate" coding.
It purpose is to provide the next suffix to an Invoice number consisting of the (Month-Year-Next Record No).
May I further add that I had to resort to a Mickey-mouse technique in setting the first record no in the Database. I did not know how to avoid going to the bottom of the Worksheet when the database is empty.
How can I modify this, so that I could start with any number, and not '0001??
Sub NextRecordNo()
'Summary: To Set a Record No for each Invoice in the
' Invoice Database, and to Set the Suffix for the
' Next Invoice Number
'Step 1 is to position all sheets to A1
Call ToFirstCellAllSheets
'Step 2 To insure that the first Record No is in place.
Sheets("Invoice Database").Select
Selection.End(xlToRight).Select
Range("HP2").Select
ActiveCell.FormulaR1C1 = "'0001"
Range("A1").Select
'Step 3 To create the Next Record No in
' the Invoice Database,
Sheets("Invoice Database").Select
Range("A1").Select
Selection.End(xlToRight).Select
Selection.End(xlDown).Select
ActiveCell.Range("A1:A2").Select
Selection.DataSeries Rowcol:=xlColumns, _
Type:=xlAutoFill, Date:=xlDay, _
Trend:=False
Selection.End(xlDown).Select
Selection.Copy
'Step 4 Post new Record No to the Invoice Master
' Cell N4
Sheets("Invoice Master").Select
ActiveCell.Offset(2, 13).Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Sheets("Invoice Database").Select
Application.CutCopyMode = False
Range("A1").Select
End Sub