#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Lock Cells

Hi All,

I have created a small application using VBA on Excel 2002. Every month
I upload data into the data workbook, on a new column, from input files
using the macros which are stored in a different workbook.

I am facing some problems recently. I have no idea how but some data is
either getting deleted or changed. Is there any way I can protect my
data/macro workbook or may be lock cells.

What I was thinking is may be after every monthly upload I lock the
column that had been populated. But my worry is that if I have to, may
be in future, update some data then what should I do. Right now I am
taking copies of my workbook(s) every month but sooner or later I will
have space problems. This application will be run for the next 5 years
or so.

So can someone suggest me the best possible way for protection.

I have recently started working on Excel VBA (my background being AS400
before). Therefore I would also request someone to direct/suggest me to
any tutorials or books on the net as I want to fully understand what I
can do using VBA on Excel.

I think I have asked a lot here but would sincerely appreciate if
someone comes back to me asap on this.

Thanks & Regards,
Prasad

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Lock Cells

Prasad,

I always recommend the below reference. What it does is when the workbook
opens
it protects all worksheets such that only cells with Protection = Unlocked
can be selected.
It also allows protected cells to be changed through code.

So manually or throught code you can protect individual cells or groups of
cells. You may have to
unprotect/protect the worksheet through code.

Let me know if you need any further help...

==========================
Select UnProtected Cells ONLY
This will prevent users from clicking on protected cells on all
worksheets. Therefore, the warning message will not appear. The code
must be enterred in the ThisWorkbook module.

Note that the EnableSelection property must be reset each time the
workbook is opened as it defaults to xlNoRestrictions. The
worksheet(s)
must first be unprotected to set the EnableSelection property and then
must be protected for it to take effect.

Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
WS.Unprotect 'Password:="wxyz"
WS.EnableSelection = xlUnlockedCells
WS.Protect 'Password:="wxyz", UserInterfaceOnly:=True
Next
End Sub

Regards,
Greg Wilson 5/3/03

Further to Steve's comment, I was running xl97 back then (2003). I now
have
xl2000 and I note that you don't have to unprotect anymore before
changing
the EnableSelection property. You still have to reset the
EnableSelection
property to xlUnlockedCells each time the wb is opened. You should
experiment
with whatever version you are running.
Greg Wilson 7/25/05

--
steveB

Remove "AYN" from email to respond
wrote in message
oups.com...
Hi All,

I have created a small application using VBA on Excel 2002. Every month
I upload data into the data workbook, on a new column, from input files
using the macros which are stored in a different workbook.

I am facing some problems recently. I have no idea how but some data is
either getting deleted or changed. Is there any way I can protect my
data/macro workbook or may be lock cells.

What I was thinking is may be after every monthly upload I lock the
column that had been populated. But my worry is that if I have to, may
be in future, update some data then what should I do. Right now I am
taking copies of my workbook(s) every month but sooner or later I will
have space problems. This application will be run for the next 5 years
or so.

So can someone suggest me the best possible way for protection.

I have recently started working on Excel VBA (my background being AS400
before). Therefore I would also request someone to direct/suggest me to
any tutorials or books on the net as I want to fully understand what I
can do using VBA on Excel.

I think I have asked a lot here but would sincerely appreciate if
someone comes back to me asap on this.

Thanks & Regards,
Prasad



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
HOW DO I LOCK CERTAIN CELLS Dan A. Excel Discussion (Misc queries) 2 October 16th 09 10:13 PM
lock cells John R Excel Worksheet Functions 5 May 3rd 08 12:10 AM
How To Lock Cells Ziggy M Excel Discussion (Misc queries) 3 August 18th 06 02:24 PM
Lock Cells Diana Excel Discussion (Misc queries) 2 September 26th 05 07:27 PM
lock cells [email protected] Excel Programming 1 April 8th 05 05:23 AM


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