Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 22nd, 2005, 04:05 AM
Authorized User
 
Join Date: Jan 2005
Location: Kuala Lumpur, Fed. Territory, Malaysia.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Protection and commandButtons

Hi, To all Gurus!

   When I protect a particular worksheet, it includes formulas on certain cells.
    However, when I click a commandbutton the macros should run to change a particular cell to another value, even though a formula like "=Sum(K2+K3)" is laready on that cell.
    This is not the case when Sheet Protection is on. Each time I click on the Commandbutton, it displays this "Sheet is protected".
     How do I go about it to run the procedures attached to the commandbuttons in a protected sheet, as other cells are also required to be protected.
     The answer given by Excel is to unprotect the worksheet, but this will lead to other cells that should be protected becoming unprotected again!
:(
Reply With Quote
  #2 (permalink)  
Old February 22nd, 2005, 04:29 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: , , Finland.
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

You must unprotect your sheet first then change cell and then
protect your sheet again

Sub Code()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, _ Scenarios:=True
'*** Do some changes here
ActiveSheet.Unprotect
End Sub

Reply With Quote
  #3 (permalink)  
Old March 1st, 2005, 12:32 AM
Authorized User
 
Join Date: Jan 2005
Location: Kuala Lumpur, Fed. Territory, Malaysia.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi! Vemaju,
Sorry for the delay in thanking you.
I found out the same principle as yours earlier on and forgot to return to this forum on time.
 I started off with codes to unprotect the sheet first , then ending it by protecting codes!
   It's good to have someone like you assisting me, but I am not sure whether it's proper for me to ask farther as I am still on the "Commandbutton topic", or shall I post a new topic?
Reply With Quote
  #4 (permalink)  
Old March 4th, 2005, 09:27 AM
Friend of Wrox
 
Join Date: Jan 2005
Location: Bournemouth, Dorset, United Kingdom.
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Never be afraid to ask, I always say the only bad type of question is the one not asked.

Matt

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
DB Protection ~Bean~ SQL Language 4 October 25th, 2005 07:37 AM
Commandbuttons in Reports DaDeViL Access VBA 2 August 19th, 2005 08:13 AM
Protection evad Excel VBA 0 April 26th, 2005 09:06 AM
Active X -Commandbuttons bahachin Excel VBA 4 January 24th, 2005 02:26 PM
Protection level noman77 .NET Framework 2.0 0 October 23rd, 2004 07:33 AM



All times are GMT -4. The time now is 10:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.