Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Sam
 
Posts: n/a
Default disable cells editing

Hi;
I'd like to prevent the user to edit the content of my cells in the
sheet. This is easy, however I want these same cells to be editable
progamatically by my macros. And this is my problem, if I lock the
cell, how can i modify them in the macros ?

thx

  #2   Report Post  
Hank Scorpio
 
Posts: n/a
Default

On 24 Apr 2005 03:05:07 -0700, "Sam"
wrote:

Hi;
I'd like to prevent the user to edit the content of my cells in the
sheet. This is easy, however I want these same cells to be editable
progamatically by my macros. And this is my problem, if I lock the
cell, how can i modify them in the macros ?


Unprotect the sheet by VBA code before you edit it:

Sub EditProtectedSheet()

If Sheet1.ProtectContents Then
Sheet1.Unprotect "MyPassword"
End If

Sheet1.Cells(1, 3).Value = "Input2"

Sheet1.Protect "MyPassword"

End Sub



---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *
  #3   Report Post  
Sam
 
Posts: n/a
Default

thx, but in that case, anyone who can open a macro code can actually
see the password and modify the data, how can i prevent this to happen ?

  #4   Report Post  
 
Posts: n/a
Default

After protecting the sheet through VBA, lock the VBA for editing.

  #5   Report Post  
Sam
 
Posts: n/a
Default

lock the vba for editing : how do i do that ?

Thx !



  #6   Report Post  
Gord Dibben
 
Posts: n/a
Default

Sam

ALT + F11 to get to VB Editor.

CTRL + r to open Project Explorer.

Select your project/workbook.

Right-click and VBA Project Properties.

Select Protection tab and follow your nose.

Workbook must be saved at that point.


Gord Dibben Excel MVP

On 24 Apr 2005 08:23:24 -0700, "Sam" wrote:

lock the vba for editing : how do i do that ?

Thx !


  #7   Report Post  
Sam
 
Posts: n/a
Default

thx a lot. i got it working

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
disable cells Ganesh Excel Discussion (Misc queries) 1 March 10th 05 01:07 PM
Help adding text values Texas-DC_271 Excel Worksheet Functions 7 January 15th 05 11:14 PM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM
Heps to design Locked/Unlocked cells in protected worksheet Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:09 AM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM


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