Updating Excel sheet when using another Excel sheet as a template

pemco

New Member
Joined
Feb 17, 2018
Messages
5
I'm using Excel 2003.
I have an Excel spreadsheet that I'd like to use as a template for quotations for my company.
Our quotes manager will enter the information into the spreadsheet, do a "save as" each time he quotes a job. The original sheet will be used as the template.
Is there a way to dynamically collect the data from the first sheet (even though it'll be saved as something different each time) into another Excel sheet that can be used for tracking open quotes?
Thanks in advance for any help!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi pemco and Welcome to the Board! I would suggest using this code. No need to save the template with its' data ie. it can be cleared for the next input. The code saves the workbook to the same file location with the same file name and date. It can be adjusted to input a file name instead of the date and/or same file name. HTH. Dave
Code:
Sub CopyDateFile()
Dim Ofsobj As Object, NowStr As String
Set Ofsobj = CreateObject("Scripting.FileSystemObject")
NowStr = Format(Now, "yyyy/mm/dd")
Ofsobj.CopyFile ThisWorkbook.FullName, Left(ThisWorkbook.FullName, _
   Len(ThisWorkbook.FullName) - 5) & "_" & NowStr & ".xlsm", True  'source,destination,save
Set Ofsobj = Nothing
End Sub
ps. U may need to change the file extension ".xlsm" to whatever
 
Last edited:
Upvote 0
Hi pemco and Welcome to the Board! I would suggest using this code. No need to save the template with its' data ie. it can be cleared for the next input. The code saves the workbook to the same file location with the same file name and date. It can be adjusted to input a file name instead of the date and/or same file name. HTH. Dave
Rich (BB code):
Sub CopyDateFile()
Dim Ofsobj As Object, NowStr As String
Set Ofsobj = CreateObject("Scripting.FileSystemObject")
NowStr = Format(Now, "yyyy/mm/dd")
Ofsobj.CopyFile ThisWorkbook.FullName, Left(ThisWorkbook.FullName, _
   Len(ThisWorkbook.FullName) - 5) & "_" & NowStr & ".xlsm", True  'source,destination,save
Set Ofsobj = Nothing
End Sub
ps. U may need to change the file extension ".xlsm" to whatever
If the OP is using xl2003 then this might work better
Code:
Len(ThisWorkbook.FullName) - [COLOR=#FF0000]4[/COLOR])
 
Upvote 0
Hi pemco and Welcome to the Board! I would suggest using this code. No need to save the template with its' data ie. it can be cleared for the next input. The code saves the workbook to the same file location with the same file name and date. It can be adjusted to input a file name instead of the date and/or same file name. HTH. Dave
Code:
Sub CopyDateFile()
Dim Ofsobj As Object, NowStr As String
Set Ofsobj = CreateObject("Scripting.FileSystemObject")
NowStr = Format(Now, "yyyy/mm/dd")
Ofsobj.CopyFile ThisWorkbook.FullName, Left(ThisWorkbook.FullName, _
   Len(ThisWorkbook.FullName) - 5) & "_" & NowStr & ".xlsm", True  'source,destination,save
Set Ofsobj = Nothing
End Sub
ps. U may need to change the file extension ".xlsm" to whatever


Thanks so much for the help! Last night, our IT guy upgraded our entire system to Windows 365. He also updated my old office suite to 2016. Will that affect the code?
Additionally: I'm a novice when it comes to codes. Where do I enter this code...in the template worksheet or the data collection worksheet? And, where exactly do I enter it? Do I need to change anything within the code to recognize the template's file name?
I apologize for my ignorance. This is way beyond my comfort level! I can handle basic Excel functions, but beyond that, I'm toast! Thanks so much for any and all guidance!
 
Upvote 0
U can place this in sheet/userform or module code. Just call/run CopYDateFile. No need to change anything for the file name as it is copied as the name of the file along with the date to the same file path/location. This is Xl 2016 code. Good luck. Dave
 
Upvote 0
Thanks so much for the help! Last night, our IT guy upgraded our entire system to Windows 365. He also updated my old office suite to 2016. Will that affect the code?
Additionally: I'm a novice when it comes to codes. Where do I enter this code...in the template worksheet or the data collection worksheet? And, where exactly do I enter it? Do I need to change anything within the code to recognize the template's file name?
I apologize for my ignorance. This is way beyond my comfort level! I can handle basic Excel functions, but beyond that, I'm toast! Thanks so much for any and all guidance!

The way the code is written, it would be most efficient to run from a standard code module like module1. To access the code module, press Alt + F11 and when the vb editor opens, if the large pane is dark, click 'Insert' on the menu bar of the vb editor. Then click 'Module'. The pane should then brighten and you can copy the code and paste it right into the large pane. Close the vb editor and save the workbook as a macro enabled workbook (.xlsm) to preserve the code. To run the code from the Excel window, press Alt + F8, left click the macro name once in the dialog box, then click 'Run'. To attach the macro to a button, on the ribbon go to 'Developer', click 'Insert' on the ribbon menu bar, then click on command button (or just button) in the Form Controls tool box. Move the cross hair (+) to where you want the button to appear on your sheet and left click once. A dialog box will appear to assign a macro, click on the macro name then click OK. You can now run the code by clicking the button on your sheet.
 
Last edited:
Upvote 0
Thanks for all the help!
I've copied the code into my worksheet and followed the steps outlined above. When I run the macro I get an error message. When I debug, the following is hi-lighted:
Ofsobj.CopyFile ThisWorkbook.FullName, Left(ThisWorkbook.FullName, _ Len(ThisWorkbook.FullName) - 5) & "_" & NowStr & ".xlsm", True 'source,destination,save

In researching a bit, I found the "Get Data" option in Excel 2016, which, in theory seems like it should work for me. When I use this, I can see the columns that I need, but they're randomly scattered throughout the worksheet and I'm unable to arrange them as I'd like.
As I mentioned initially, I'm using the initial Excel sheet as a template, so each time a sales team member enters his/her quote, they'll do a save as and then delete the information from the template. I'm concerned that this will cause an issue.

Please forgive my ignorance. I've never worked with macros or codes before and I'm somewhat clueless.

Thanks so much for helping me!
 
Upvote 0
The code works as posted. Don't know what's up? No idea what's with "Get Data" part of your post? Dave
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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