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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the board.

You could instead use SaveCopyAs, and then save the master in the usual way.
 
Upvote 0
Thanks! I knew there had to be an easier, more straight-forward way of attacking this.

Thanks again!:)
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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
Back
Top