Using SaveAs but keeping updated information in original

JAlbers

Board Regular
Joined
Sep 9, 2011
Messages
60
I have a master file that will have a transaction number generated, data will be entered by the user and lookups will be performed on the data they enter. The file is then going to be saved in a named folder using the transaction number generated as the file name.xls.

The transaction number is simply taking a seed number and adding one to it. My problem comes in when I save the file as the new transaction number.xls the original transaction seed number in the master file doesn’t get saved, therefor I end up with all my transaction numbers being the same.

Here is the code snippet I am using to increment the transaction number:

Sub New_MTR_Number()
LastMTR = Worksheets("OldMTRNumber").Range("A1").Value
NextMTR = LastMTR + 1
Worksheets("MTR").Range("E6").Value = NextMTR
Worksheets("OldMTRNumber").Range("A1").Value = NextMTR
End Sub

After saving the newly named file to a transaction folder, this file would be closed, and the new transaction number lost. My thought is to save this master file when the transaction number is incremented, then when the other data has been entered for the lookup, it can be saved using save as to the new file name (transaction number.xls)
Somehow, I feel that I am making this harder than it should be, and I will appreciate any help I can get.
Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
Welcome to the board.

You could instead use SaveCopyAs, and then save the master in the usual way.
 

JAlbers

Board Regular
Joined
Sep 9, 2011
Messages
60
Thanks! I knew there had to be an easier, more straight-forward way of attacking this.

Thanks again!:)
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
You're welcome, good luck.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,260
Messages
5,769,091
Members
425,516
Latest member
Melzebu

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
Top