masud8956
Board Regular
- Joined
- Oct 22, 2016
- Messages
- 163
- Office Version
- 2016
- 2011
- 2007
- Platform
- Windows
Hi all!
In my workbook I have 5 sheets.
In 2 of the sheets named "DATA" and "DATA COPY" I have imported a large array of data from another folder through macro and used those data in other 3 sheets.
I kept these 2 sheets in "xlSheetVeryHidden" format to deny access to users. In "DATA" and "DATA COPY" sheet I was trying to run a macro to clear contents of the range A1:O4000 (or clear contents of the whole sheets - even better). I want the code to access these 2 sheets, clear contents of the said range (or of the whole sheets) and return to original formatting (xlSheetVeryHidden). I was trying the following code:
The code seems to take about 25-35 seconds to complete the task. But after the run is complete the sheets do not go back to the original formatting (xlSheetVeryHidden). They become "xlSheetHidden" and thus they can be easily unhidden by users which I do not want.
In fact I bumped into a very old thread (from 2002) regarding this where I took the idea of the code. Link below:
What modification could be done to solve the problem? Anyone please?
Thanks in advance
In my workbook I have 5 sheets.
In 2 of the sheets named "DATA" and "DATA COPY" I have imported a large array of data from another folder through macro and used those data in other 3 sheets.
I kept these 2 sheets in "xlSheetVeryHidden" format to deny access to users. In "DATA" and "DATA COPY" sheet I was trying to run a macro to clear contents of the range A1:O4000 (or clear contents of the whole sheets - even better). I want the code to access these 2 sheets, clear contents of the said range (or of the whole sheets) and return to original formatting (xlSheetVeryHidden). I was trying the following code:
Code:
[/COLOR]Sub ClearMe()Application.ScreenUpdating = False
Sheets("DATA").Visible = True
Sheets("DATA COPY").Visible = True
'
' ClearMe Macro
'
'
Sheets(Array("DATA", "DATA COPY")).Select
Sheets("DATA").Activate
Cells.Select
Selection.ClearContents
Sheets("DATA").Visible = False
Sheets("DATA COPY").Visible = False
Application.ScreenUpdating = True
End Sub[COLOR=#333333]
The code seems to take about 25-35 seconds to complete the task. But after the run is complete the sheets do not go back to the original formatting (xlSheetVeryHidden). They become "xlSheetHidden" and thus they can be easily unhidden by users which I do not want.
In fact I bumped into a very old thread (from 2002) regarding this where I took the idea of the code. Link below:
HTML:
https://www.mrexcel.com/forum/excel-questions/31275-running-macros-hidden-sheets.html
What modification could be done to solve the problem? Anyone please?
Thanks in advance