Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro doesn't work when I use Protection

I have a macro to insert rows in my worksheet. When I turn on protection, so
user can only access unlocked cells, my macro will not work. How can I use
both the macro and the protection option?
  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Macro doesn't work when I use Protection

unprotect your worksheet before you do your code and then protect when done
ie...
you can remove the password key word if there is no password
ie
activesheet.unprotect


sub insertrows()
activesheet.unprotect password:="enter your password here"
'insert rows edit cells whatever here
activesheet.protect password:="enter your password here"
end sub


--
When you lose your mind, you free your life.


"Janet H." wrote:

I have a macro to insert rows in my worksheet. When I turn on protection, so
user can only access unlocked cells, my macro will not work. How can I use
both the macro and the protection option?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default Macro doesn't work when I use Protection

Is there a way to have a password on a sheet or workbook and have VBA still
unlock and protect with same password after. At present I try and get box to
enter password.
Any ideas Thanks a lot
Curt

"ben" wrote:

unprotect your worksheet before you do your code and then protect when done
ie...
you can remove the password key word if there is no password
ie
activesheet.unprotect


sub insertrows()
activesheet.unprotect password:="enter your password here"
'insert rows edit cells whatever here
activesheet.protect password:="enter your password here"
end sub


--
When you lose your mind, you free your life.


"Janet H." wrote:

I have a macro to insert rows in my worksheet. When I turn on protection, so
user can only access unlocked cells, my macro will not work. How can I use
both the macro and the protection option?

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
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
2007 vs 2003 - work protection Theo Excel Discussion (Misc queries) 1 June 27th 08 06:01 PM
protection is not work. pure copper Excel Worksheet Functions 5 February 12th 08 08:11 PM
work sheet protection taxrelief Excel Discussion (Misc queries) 1 July 20th 05 05:43 AM
using protection (but allowing a combobox to still work) neowok[_39_] Excel Programming 5 March 4th 04 02:48 PM


All times are GMT +1. The time now is 01:04 AM.

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

About Us

"It's about Microsoft Excel"