Good Morning,
Please help! I have been searching the web for ages for a solution - have tried a few things, but am still searching for a solution............
I am very new to VBA, so I am still trying to wrap my head around some of the stuff.
I have a purchase requisition form that Auto Increments on Startup and then also Auto Saves the form on close. The problem is that the Purchase Requisition number '09035-0001' increments to '09036-0001' and I want it to increment to '09035-0002' as the first portion refers to my project number. The current code I am using is (in ThisWorkbook):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saveworkbook
End Sub
_____________________________________________________
Private Sub Workbook_Open()
With Sheets("Sheet1").Range("G6")
.Value = .Value + 1
End With
End Sub
The workbook saves automatically as it closes and for that I am using (in module1):
Sub Saveworkbook()
Application.DisplayAlerts = False
Dim dName$, vName$
dName = Range("G6")
vName = ActiveWorkbook.FullName
ActiveWorkbook.SaveAs "Y:\New folder\" & dName
ActiveWorkbook.SaveAs vName
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
Thank you for any assistance you can afford me.
Please help! I have been searching the web for ages for a solution - have tried a few things, but am still searching for a solution............
I am very new to VBA, so I am still trying to wrap my head around some of the stuff.
I have a purchase requisition form that Auto Increments on Startup and then also Auto Saves the form on close. The problem is that the Purchase Requisition number '09035-0001' increments to '09036-0001' and I want it to increment to '09035-0002' as the first portion refers to my project number. The current code I am using is (in ThisWorkbook):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saveworkbook
End Sub
_____________________________________________________
Private Sub Workbook_Open()
With Sheets("Sheet1").Range("G6")
.Value = .Value + 1
End With
End Sub
The workbook saves automatically as it closes and for that I am using (in module1):
Sub Saveworkbook()
Application.DisplayAlerts = False
Dim dName$, vName$
dName = Range("G6")
vName = ActiveWorkbook.FullName
ActiveWorkbook.SaveAs "Y:\New folder\" & dName
ActiveWorkbook.SaveAs vName
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
Thank you for any assistance you can afford me.