Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default How To: Check if a cell value has changed

Hi,
I have a workbook that contains 3 locked sheets, users
can only add data to the sheets via a data entry form. On
my menu list I've added a button that turns on and off the
Auto Filter, and I turn on and off the sheet protection
when row one is selected, the procedure that turns on and
off the sheet protection is in the SheetSelectionChange()
of my class module that is set to Application.
My dilema is that I don't want users to change the
column widths or the contents or in fact make any change
to sheet while protection is disabled, all they should do
is just select the appropriate AutoFilter, but user may
press a key by accident. I know I can write code to put
the entire sheet and the contents of row one (Headers) to
what they should be, but I was wondering of the was a way
to use something like a procedure call Cell_Exit thus I
can see if the cell.row is 1 and if the contents have
change the cell.value = cell.oldvalue cell.columnwidth = 10
etc.

TIA
regards
KM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default How To: Check if a cell value has changed

Kevin,
to trap user changes, try:
Private Sub Worksheet_Change(ByVal Target As Range)
on a Worksheet module
or
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
in the ThisWorkbook module

This will not pick up on column size changes, though. You might have to
check those explicitly.

You can have protection and autofiltering at the same time, though!
Use protection with UserInterfaceOnly on each sheet. (Review the Help for
rules on setting and resetting UserInterfaceOnly protection)

For instance, on my sheet activate event, I use:

Me.EnableAutoFilter = True
Me.Protect Userinterfaceonly:=True
which does the trick. Protected Sheet, but with AutoFiltering!.

Also, I could be corrected, but XL2002 might just have more advanced
lock/protect options than XL2000 (which I am running).

Alex J


"Kevin McCartney" wrote in message
...
Hi,
I have a workbook that contains 3 locked sheets, users
can only add data to the sheets via a data entry form. On
my menu list I've added a button that turns on and off the
Auto Filter, and I turn on and off the sheet protection
when row one is selected, the procedure that turns on and
off the sheet protection is in the SheetSelectionChange()
of my class module that is set to Application.
My dilema is that I don't want users to change the
column widths or the contents or in fact make any change
to sheet while protection is disabled, all they should do
is just select the appropriate AutoFilter, but user may
press a key by accident. I know I can write code to put
the entire sheet and the contents of row one (Headers) to
what they should be, but I was wondering of the was a way
to use something like a procedure call Cell_Exit thus I
can see if the cell.row is 1 and if the contents have
change the cell.value = cell.oldvalue cell.columnwidth = 10
etc.

TIA
regards
KM



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How To: Check if a cell value has changed

Hi Alex,
I forgot to mention, this problem is in Excel 97, the
company moves to XP and Office 2003 next year hence this
solution is just temporary. Although there are some
locations in Europe that still use 0S2 Warp and Excel 5.0
yep Office 4.3 and yes I am from this planet and current
time zone heheheh, anyway thanks for the tip but I'm using
the SheetSelectionChange but I don't think there is a
Selection_Exit, I think I just reformat the sheet ie
Columns("A:AB").width = 11 and then iterate throught is
cell from A1 to AB1 and re enter the text and format the
cell. Its a shame that I can't trust the users to just
click on the auto filter and not change width content
color, naja if users weren't individual I'd lead a boring
life.

Ok thanks
ciao
KM

-----Original Message-----
Kevin,
to trap user changes, try:
Private Sub Worksheet_Change(ByVal Target As Range)
on a Worksheet module
or
Private Sub Workbook_SheetChange(ByVal Sh As Object,

ByVal Target As Range)
in the ThisWorkbook module

This will not pick up on column size changes, though. You

might have to
check those explicitly.

You can have protection and autofiltering at the same

time, though!
Use protection with UserInterfaceOnly on each sheet.

(Review the Help for
rules on setting and resetting UserInterfaceOnly

protection)

For instance, on my sheet activate event, I use:

Me.EnableAutoFilter = True
Me.Protect Userinterfaceonly:=True
which does the trick. Protected Sheet, but with

AutoFiltering!.

Also, I could be corrected, but XL2002 might just have

more advanced
lock/protect options than XL2000 (which I am running).

Alex J


"Kevin McCartney"

wrote in message
...
Hi,
I have a workbook that contains 3 locked sheets, users
can only add data to the sheets via a data entry form.

On
my menu list I've added a button that turns on and off

the
Auto Filter, and I turn on and off the sheet protection
when row one is selected, the procedure that turns on

and
off the sheet protection is in the SheetSelectionChange

()
of my class module that is set to Application.
My dilema is that I don't want users to change the
column widths or the contents or in fact make any change
to sheet while protection is disabled, all they should

do
is just select the appropriate AutoFilter, but user may
press a key by accident. I know I can write code to put
the entire sheet and the contents of row one (Headers)

to
what they should be, but I was wondering of the was a

way
to use something like a procedure call Cell_Exit thus I
can see if the cell.row is 1 and if the contents have
change the cell.value = cell.oldvalue cell.columnwidth

= 10
etc.

TIA
regards
KM



.

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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Format changed when the details in cell changed angel Excel Worksheet Functions 9 July 15th 08 12:36 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
How can I check if data in an external data range is changed afte. Ruud Excel Worksheet Functions 0 January 7th 05 12:15 PM
How can I check if data in external data range is changed after re Ruud Excel Discussion (Misc queries) 0 January 7th 05 12:07 PM


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