HI,
Is there a way through VBA to prevent a particular cell from being changed by a user? this particular cell contains an auto increment invoice number (by vba function) and don't want users to change this to any other number.
my code looks like this;
Sub NextInvoice()
Range("L11").Value = Range("L11").Value + 1
Range("L11").NumberFormat = "00000"
Range("L11").Locked = True
Range("A16:C37").ClearContents
Range("L16:L37").ClearContents
Range("H13").ClearContents
End Sub
Sub SaveInvWithNewName()
Dim NewFN As Variant
' Copy Invoice to a new workbook '
NewFN = "C:\Excel\DNote-" & Range("L11").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityMaximum, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Workbooks("Delivery Note.xlsm").Save
Application.Quit
End Sub
Thanks for your help
Kevin
Is there a way through VBA to prevent a particular cell from being changed by a user? this particular cell contains an auto increment invoice number (by vba function) and don't want users to change this to any other number.
my code looks like this;
Sub NextInvoice()
Range("L11").Value = Range("L11").Value + 1
Range("L11").NumberFormat = "00000"
Range("L11").Locked = True
Range("A16:C37").ClearContents
Range("L16:L37").ClearContents
Range("H13").ClearContents
End Sub
Sub SaveInvWithNewName()
Dim NewFN As Variant
' Copy Invoice to a new workbook '
NewFN = "C:\Excel\DNote-" & Range("L11").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityMaximum, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Workbooks("Delivery Note.xlsm").Save
Application.Quit
End Sub
Thanks for your help
Kevin