ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2 Part question involving SaveAs and Auto Save when quit. (https://www.excelbanter.com/excel-programming/338985-2-part-question-involving-saveas-auto-save-when-quit.html)

ryanmhess

2 Part question involving SaveAs and Auto Save when quit.
 
Here is the code I use to select Sheet3, make a copy of Sheet3, save Sheet3
as a new file and saved as the value in cell B15.

Sheets("Sheet3").Select
Sheets("Sheet3").Copy
ActiveWindow.ScrollRow = 1

ActiveWorkbook.SaveAs Filename:="\\Hci\HCI Share\C of A's - Building
4\00-RMHTest-6 ParametersXXXX\" & _
Range("B15").Value & ".xls"
ActiveWorkbook.Close

When I enter data in my workbook the value of B15 is unique for every new
entry.

How do I avoid accidently saving over a file previously created?

ex. I had entered "12345" into cell B15 and "hello" into cell B16 and ran
my macro. An hour later I wanted to enter new data and I entered "12345"
into cell B15 and "goodbye" into cell B16 and ran my macro.

This would leave me with a copy of Sheet3 saved as "12345" with "goodbye" in
B16 when I wanted "hello" in B16.

Second Part of question.

Each copy of Sheet3 that is saved as a new workbook and saved as the value
in cell B15 is locked and protected. I do not want anyone to be able to
modify this file but me. Whenever I open one of these files even though I
cant change anything, and nothing changes it still asks me if I want to save
or not. I cannot spend the time to go through each new file created and add
a macro to automatically close.

Is there a way to set it up in the code above so that the New file of Sheet3
never asks if you would like to save it?


Thank you for your help.
Ryan Hess


All times are GMT +1. The time now is 02:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com