#1   Report Post  
John
 
Posts: n/a
Default Macro

Can you unprotect a sheet within a Macro?
  #2   Report Post  
Paul B
 
Posts: n/a
Default

John, yes something like this


Sub test()

ActiveSheet.Unprotect password:="123" 'change password here

End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"John" wrote in message
...
Can you unprotect a sheet within a Macro?



  #3   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

Yes

Sub UnProtectSheet()
PWD = "password"
Worksheets("sheet1").Unprotect Password:=PWD
End Sub



Regards,

Peo Sjoblom

"John" wrote:

Can you unprotect a sheet within a Macro?

  #4   Report Post  
John
 
Posts: n/a
Default

This unfortunately did not work. I am using two worksheets if that changes
anything.
I have a space for a tax ID number, but in some cases you might use and
Federal Tax ID number (FEIN) If i have the protection off, it changes the
cell format, then takes that number and puts it in another cell in a
different worksheet and changes the cell format again to FEIN, then takes you
back to the original worksheet. However when you put the protection on, it
wont work.

"Peo Sjoblom" wrote:

Yes

Sub UnProtectSheet()
PWD = "password"
Worksheets("sheet1").Unprotect Password:=PWD
End Sub



Regards,

Peo Sjoblom

"John" wrote:

Can you unprotect a sheet within a Macro?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM
Executing macro for all worksheet from a different worksheet Biti New Users to Excel 3 December 8th 04 10:05 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro Formula revision? Mark Excel Worksheet Functions 1 November 28th 04 01:43 AM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"