I have this script that does half of what I want but I can't figure out how to get it to do the rest. If you copy it into a standard model it will pretty much explain what it does. What I need it to do is if you save save the file with and new name so you can keep the templet the same and colse the new file, it will change the number in H1 and I don't want it to. I want all old files to keep the number it has and only the templet to change. I have tried a few different IF...Then...Else statements but I can't get any of them to work. If someone could shoot me to the right direction that would be great. Here is the code:
Sub Auto_open()
On Error GoTo ErrorHandler
One:
Open "c:\Counter.txt" For Input As #1
Input #1, x
Close #1
x = x + 1
Two:
Sheets(1).Range("h1").Value = x
Open "c:\Counter.txt" For Output As #1
Write #1, x
Close #1
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 53 'If Counter file does not exist...
x = InputBox("Enter Number to Begin Counting With", "Create 'Counter.txt' File")
Resume Two
Case Else
Resume Next
End Select
End Sub
Thanks,
Bill
Sub Auto_open()
On Error GoTo ErrorHandler
One:
Open "c:\Counter.txt" For Input As #1
Input #1, x
Close #1
x = x + 1
Two:
Sheets(1).Range("h1").Value = x
Open "c:\Counter.txt" For Output As #1
Write #1, x
Close #1
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 53 'If Counter file does not exist...
x = InputBox("Enter Number to Begin Counting With", "Create 'Counter.txt' File")
Resume Two
Case Else
Resume Next
End Select
End Sub
Thanks,
Bill