I am just beginning to use EXCEL VBA. Have the following code in the start-up module:
Option Explicit
Private Sub Workbook_Open()
With Worksheets(“WORK_ORDER”).Range(“D7”)
If .Value = “” Then
.Value = “CD-0001”
Else
.Value = Left(.Value, 3) & Format(Right(.Value, 4) + 1, “0000”)
End If
End With
ActiveWorkbook.Save
Worksheets(“WORK_ORDER”).Select
End Sub
Receive a Runtime Error 1004, Document not saved message. I believe the syntax is correct. Anyone have an idea as to what I am doing wrong?