Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Password Protecting/Unprotecting Worksheets using VBA code?

Of course not. There is nothing unexpected or adverse in what you do, and we
are free to ignore you <bg.

Keep asking, we'll keep answering.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"dim" wrote in message
...
Thanks 'again' Bob,

I hope Im not annoying everyone with all my question, but VBA code is new
to
me, and anything I learn I add into my library so I don't have to ask
again.

Thanks.

"Bob Phillips" wrote:

With Worksheets("Sheet1")
.Unprotect "password"
.Rows(2).Insert
.Protect "password"
End With

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"dim" wrote in message
...
Hi folks,

I have a workbook called Book2. A macro opens Book2, inserts and saves
user
data, then closes Book2.

This all worked fine until I just tried it out with the password
applied
to
Book2. the password is "pswd". When the code attempts to insert a row
into
Book2's sheet as below, it hangs because it cant insert a row when all
the
cells are locked. I thought this might happen, thats why I tested it
now.
But
I dont know the VBA code I need....

Rows("2:2").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown

Can someone please tell me what to add to the code to unprotect the
sheet
using the password, then reprotect it before saving and closing?

Thankyou.






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
Protecting and Unprotecting several worksheets at one time Learning Excel Excel Discussion (Misc queries) 8 February 4th 09 10:07 PM
Macro for protecting and unprotecting multiple worksheets saltnsnails Excel Discussion (Misc queries) 7 January 24th 08 10:49 PM
Password Protecting/Unprotecting Via Code MWS Excel Programming 3 December 12th 05 03:21 PM
Macro for unprotecting/protecting worksheets WITH passwords John Baker Excel Programming 2 July 7th 04 01:19 PM
Protecting & unprotecting worksheets pkley Excel Programming 1 January 7th 04 10:28 PM


All times are GMT +1. The time now is 12:24 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"