Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here's my last dialogue. I'm still unable to clear a cell upon Close
Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The reason the cells still contained information was, as you've no doubt
figured out, because macros were disabled, so the code couldn't run to clear the cells. You don't want people to have to deal with macro warnings, well, it's hard to get around that little thing. You could tell your users to set Macro Security to LOW which is pretty much "off" and very unsafe for them to use. They can set it to MEDIUM which will give a warning, offering them the opportunity to use macros or not - the lowest setting that I recommend - but always requires an extra click to get a workbook containing macros to open. If you had (and they had) Excel 2007, you could declare a trusted location on their system/network where any workbooks stored would open without any warnings. Should I get a certificate: probably not unless you have pretty deep pockets. They're expensive. You can 'self certify' and ask your users to add you to their trusted publishers. This may be the easy way. Your application cannot control their macro security. As for the Private Sub Workbook_BeforeClose(Cancel As Boolean) code, yes, all of the parenthesis and quotation marks are absolutely required for it to run as it is now written. As for the _SelectionChange() routine, and you deleting it - that was just fine. No harm done at all. That's the default routine 'stub' that is created when you start a worksheet event code section. BTW: your Workbook_BeforeClose() code should be in the ThisWorkbook code area, not in one of the worksheet's code areas. I'm with Gary - there simply is no non-VBA/Macro way of clearing a cell when you close a workbook. Kind of would be cool if there was something like conditional formatting that is dependent upon the worksheet/workbook events for this kind of thing... Excel 2020 perhaps? "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
i just ran the macro on a test file and it worked file. you may need to set your macro security to low. 2003 on the menu bartoolsmacrosecurity 2007 office buttonexcel optionspopularshow developers tab on ribbon as to your other users, you will have to set their security to low also. you can't do that with the file so far as i know. oh! and i left out a line on the macro.... Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A24").ClearContents Sheets("Sheet1").Range("A25").ClearContents ActiveWorkbook.Close True End Sub this will prevent you from having to save the file again after the macro runs. it will save the file again but it will be automatic. regards FSt1 "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks you guys!
"FSt1" wrote: hi i just ran the macro on a test file and it worked file. you may need to set your macro security to low. 2003 on the menu bartoolsmacrosecurity 2007 office buttonexcel optionspopularshow developers tab on ribbon as to your other users, you will have to set their security to low also. you can't do that with the file so far as i know. oh! and i left out a line on the macro.... Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A24").ClearContents Sheets("Sheet1").Range("A25").ClearContents ActiveWorkbook.Close True End Sub this will prevent you from having to save the file again after the macro runs. it will save the file again but it will be automatic. regards FSt1 "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I guess my next question is how do i re-enable macros so this one will run?
"JLatham" wrote: The reason the cells still contained information was, as you've no doubt figured out, because macros were disabled, so the code couldn't run to clear the cells. You don't want people to have to deal with macro warnings, well, it's hard to get around that little thing. You could tell your users to set Macro Security to LOW which is pretty much "off" and very unsafe for them to use. They can set it to MEDIUM which will give a warning, offering them the opportunity to use macros or not - the lowest setting that I recommend - but always requires an extra click to get a workbook containing macros to open. If you had (and they had) Excel 2007, you could declare a trusted location on their system/network where any workbooks stored would open without any warnings. Should I get a certificate: probably not unless you have pretty deep pockets. They're expensive. You can 'self certify' and ask your users to add you to their trusted publishers. This may be the easy way. Your application cannot control their macro security. As for the Private Sub Workbook_BeforeClose(Cancel As Boolean) code, yes, all of the parenthesis and quotation marks are absolutely required for it to run as it is now written. As for the _SelectionChange() routine, and you deleting it - that was just fine. No harm done at all. That's the default routine 'stub' that is created when you start a worksheet event code section. BTW: your Workbook_BeforeClose() code should be in the ThisWorkbook code area, not in one of the worksheet's code areas. I'm with Gary - there simply is no non-VBA/Macro way of clearing a cell when you close a workbook. Kind of would be cool if there was something like conditional formatting that is dependent upon the worksheet/workbook events for this kind of thing... Excel 2020 perhaps? "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Gary,
Changes to Excel's macro security level do not take place immediately. After you make a change, you have to close Excel and then reopen it for the change you made to take effect. "Gary" wrote: I guess my next question is how do i re-enable macros so this one will run? "JLatham" wrote: The reason the cells still contained information was, as you've no doubt figured out, because macros were disabled, so the code couldn't run to clear the cells. You don't want people to have to deal with macro warnings, well, it's hard to get around that little thing. You could tell your users to set Macro Security to LOW which is pretty much "off" and very unsafe for them to use. They can set it to MEDIUM which will give a warning, offering them the opportunity to use macros or not - the lowest setting that I recommend - but always requires an extra click to get a workbook containing macros to open. If you had (and they had) Excel 2007, you could declare a trusted location on their system/network where any workbooks stored would open without any warnings. Should I get a certificate: probably not unless you have pretty deep pockets. They're expensive. You can 'self certify' and ask your users to add you to their trusted publishers. This may be the easy way. Your application cannot control their macro security. As for the Private Sub Workbook_BeforeClose(Cancel As Boolean) code, yes, all of the parenthesis and quotation marks are absolutely required for it to run as it is now written. As for the _SelectionChange() routine, and you deleting it - that was just fine. No harm done at all. That's the default routine 'stub' that is created when you start a worksheet event code section. BTW: your Workbook_BeforeClose() code should be in the ThisWorkbook code area, not in one of the worksheet's code areas. I'm with Gary - there simply is no non-VBA/Macro way of clearing a cell when you close a workbook. Kind of would be cool if there was something like conditional formatting that is dependent upon the worksheet/workbook events for this kind of thing... Excel 2020 perhaps? "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If I have a macro for my use, but don't want others, who get my workbook, to
deal with the macro warning, is there a way to disable the macro before I send the file or do I need to delete the macro and then send the file? "FSt1" wrote: hi i just ran the macro on a test file and it worked file. you may need to set your macro security to low. 2003 on the menu bartoolsmacrosecurity 2007 office buttonexcel optionspopularshow developers tab on ribbon as to your other users, you will have to set their security to low also. you can't do that with the file so far as i know. oh! and i left out a line on the macro.... Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A24").ClearContents Sheets("Sheet1").Range("A25").ClearContents ActiveWorkbook.Close True End Sub this will prevent you from having to save the file again after the macro runs. it will save the file again but it will be automatic. regards FSt1 "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
delete the macro. if you don't want others to use it then it's just extra unnecessary baggage. Regards FSt1 "Gary" wrote: If I have a macro for my use, but don't want others, who get my workbook, to deal with the macro warning, is there a way to disable the macro before I send the file or do I need to delete the macro and then send the file? "FSt1" wrote: hi i just ran the macro on a test file and it worked file. you may need to set your macro security to low. 2003 on the menu bartoolsmacrosecurity 2007 office buttonexcel optionspopularshow developers tab on ribbon as to your other users, you will have to set their security to low also. you can't do that with the file so far as i know. oh! and i left out a line on the macro.... Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A24").ClearContents Sheets("Sheet1").Range("A25").ClearContents ActiveWorkbook.Close True End Sub this will prevent you from having to save the file again after the macro runs. it will save the file again but it will be automatic. regards FSt1 "Gary" wrote: Here's my last dialogue. I'm still unable to clear a cell upon Close Thanks FSt1 ! I'm a novice and need further clarification. The subroutine did not run as I received the Macro Disabled message. I clicked OK, and next time I opened the workbook, I didn't get the Macro Warning, but the subroutine apparently didn't run as the chosen cells were not blank. I don't want people who use my workbook to have to deal with macro warnings. Is this something that must be set on each user's computer, or can I set it in my workbook so the subroutine automatically runs on everyone's computer? Do I need to get a Certificate? Here's my code. Are the () and the " " necessary? I'm working in Sheet 8 and want Cells A124 and A125 to clear upon Close. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet8").Range("A124").ClearContents Sheets("Sheet8").Range("A125").ClearContents End Sub Here's the subroutine I deleted. Is this OK to delete? What does it do? Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Thanks! Gary "FSt1" wrote: hi AFAIK there isn't a non macro way to do it. try this. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").Range("A4").ClearContents Sheets("Sheet1").Range("A6").ClearContents End Sub this is workbook code. press Alt+F11 to bring up the VB editor. in the project window(far left), expand your project(file). double click ThisWorkbook. in the code window,(far right) click the left dropdown at the top and click this workbook. Private Sub Workbook_Open() should default in. delete it and paste the above in in it place. if you don't like the before close event, you can try the before save event but this would clear the cells out each time you save the file. adjust the ranges and sheet name to suit. Regards FSt1 "Gary" wrote: Is there a non-macro way to clear a cell's contents automatically when the spreadsheet is saved? This is one of several un-locked cells in my spreadsheet and I want to clear 1 or 2 specific cells each time a document is closed. I have hidden notes (a price list) that are only visible via Conditional formatting color change from white to black if a password is entered in the cell I want to clear upon Saving or exiting a document to prevent the next user, possibly a customer, from seeing the notes (price list) if not authorized. If I need a macro, what would you suggest? Also, if I send my spread to other users, will the macro work? Must they choose "Enable Macros?" each time the document is opened? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clear a cell's contents when document is saved | Excel Discussion (Misc queries) | |||
Using cell's contents as an index to a row ...? | Excel Worksheet Functions | |||
Using cell's contents as an index to a row ... ? | Excel Worksheet Functions | |||
link to a cell's contents | Excel Worksheet Functions | |||
How do I clear cell content when excel document is closed? | Excel Worksheet Functions |