How to run a Macro on Password Protected xl sheet veryhidden

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hi. The command button is in an active sheet, But it has to select data from a xl sheet very hidden in the same workbook. It showed an error when I tried to use the command button. How do I run the macro without un-protecting my sheet.
Untitled.png
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi. The command button is in an active sheet, But it has to select data from a xl sheet very hidden in the same workbook. It showed an error when I tried to use the command button. How do I run the macro without un-protecting my sheet.
View attachment 17878
The macro runs perfectly without the protection. When I run the macro it copies the data from the very hidden xl sheet to be pasted and saved. I also do not want the code to be seen when error is debug.
 
Upvote 0
How do I run the macro without un-protecting my sheet.
You don't. What you do is have the Macro temporarily unprotect it, do its work, and then re-protect it.
So it is only unprotected for the very brief time while the macro is running (and with no user interaction).

You can see how to do that here: Unprotect sheet error in VBA
 
Upvote 0
Hello Joe4. Thanks for the response . I got the solution.
Sheets("Sheet1").Activate

ActiveSheet.Unprotect "Hello"

‘Get the clipboard data

strData = .GetText

Sheets("Sheet1").Activate

ActiveSheet.Protect "Hello"
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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