Sub NextNumber()
Dim r As Range
Application.ScreenUpdating = False
Set r = Sheets(2).Range("J1")
With r
Sheets(2).Range("J1").Value = Sheets(2).Range("J1").Value + 1
Call saveit
End With
Application.ScreenUpdating = True
End Sub
Sub saveit()
Application.ScreenUpdating = False
With Sheets(2)
r = .Range("B65536").End(xlUp).Row + 1
InvN = Cells(1, 10).Text
For x = 1 To r
If .Cells(x, 2).Text = InvN Then
MsgBox ("Receipt " + InvN + " has already been Saved")
GoTo endd
End If
Next x
For a = 2 To 100
Select Case a
Case 2
.Cells(r, a) = Cells(1, 10)
Case 3
.Cells(r, a) = Cells(1, 11)
Case 4
.Cells(r, a) = Cells(1, 12)
Case 5
.Cells(r, a) = Cells(1, 13)
Case 6
.Cells(r, a) = Cells(1, 14)
Case 7
.Cells(r, a) = Cells(1, 15)
Case 8
.Cells(r, a) = Cells(1, 16)
Case 9
.Cells(r, a) = Cells(1, 17)
Case 10
.Cells(r, a) = Cells(1, 18)
Case 11
.Cells(r, a) = Cells(1, 19)
End Select
Next a
End With
Application.ScreenUpdating = True
MsgBox (" Data Updated")
endd:
End Sub
Dim r As Range
Application.ScreenUpdating = False
Set r = Sheets(2).Range("J1")
With r
Sheets(2).Range("J1").Value = Sheets(2).Range("J1").Value + 1
Call saveit
End With
Application.ScreenUpdating = True
End Sub
Sub saveit()
Application.ScreenUpdating = False
With Sheets(2)
r = .Range("B65536").End(xlUp).Row + 1
InvN = Cells(1, 10).Text
For x = 1 To r
If .Cells(x, 2).Text = InvN Then
MsgBox ("Receipt " + InvN + " has already been Saved")
GoTo endd
End If
Next x
For a = 2 To 100
Select Case a
Case 2
.Cells(r, a) = Cells(1, 10)
Case 3
.Cells(r, a) = Cells(1, 11)
Case 4
.Cells(r, a) = Cells(1, 12)
Case 5
.Cells(r, a) = Cells(1, 13)
Case 6
.Cells(r, a) = Cells(1, 14)
Case 7
.Cells(r, a) = Cells(1, 15)
Case 8
.Cells(r, a) = Cells(1, 16)
Case 9
.Cells(r, a) = Cells(1, 17)
Case 10
.Cells(r, a) = Cells(1, 18)
Case 11
.Cells(r, a) = Cells(1, 19)
End Select
Next a
End With
Application.ScreenUpdating = True
MsgBox (" Data Updated")
endd:
End Sub