Generate Next Number - Create Database of Populated Cell Contents

davidhall

Board Regular
Joined
Mar 6, 2011
Messages
174
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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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