Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 358
Default Have code check cell contents on edit.

Hi,

I am trying to identify if there is a way of having a worksheet unprotected
but preventing a cell from being edited (using the 'F2' button or simply
typing into it) if there is a formulae in it ('=' in the first character).

I can see how to check after the change has been made using
Worksheet_Change(ByVal Target As Range) but is there 'BEFORE_CHANGE' method.

The reason I want this is becuase we want end users to be able to sort,
insert etc as usual but if they select cell 'B4' and type or press the 'F2'
button a message box will appear saying they can't edit.

Andrew
160108


--
Andrew
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default Have code check cell contents on edit.

Hi Andrew,

Can use the Change event and the Selection_Change events together. With the
Selection_Change event you record the contents of a cell that the user moves
to and store this in a global variable.

If the user makes change to the restricted area the Change event 1. puts the
value of the variable back into the cell and then displays a warning message.

By the way you can protect the worksheet and still allow inserting of rows
and columns, sorting and many other things.

--
Cheers,
Shane Devenshire


"Andrew" wrote:

Hi,

I am trying to identify if there is a way of having a worksheet unprotected
but preventing a cell from being edited (using the 'F2' button or simply
typing into it) if there is a formulae in it ('=' in the first character).

I can see how to check after the change has been made using
Worksheet_Change(ByVal Target As Range) but is there 'BEFORE_CHANGE' method.

The reason I want this is becuase we want end users to be able to sort,
insert etc as usual but if they select cell 'B4' and type or press the 'F2'
button a message box will appear saying they can't edit.

Andrew
160108


--
Andrew

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
Check cell contents before print nobbyknownowt Setting up and Configuration of Excel 3 May 26th 06 11:48 PM
Edit macro to match entire cell contents nis75p06 Excel Discussion (Misc queries) 1 September 3rd 05 04:27 PM
IF statement to check cell contents Lance Gray Excel Worksheet Functions 1 May 29th 05 10:53 PM
How can I edit cell contents with a macro in Excel? Mind the gaps! Excel Discussion (Misc queries) 2 March 23rd 05 08:51 PM
How can I edit cell contents with a macro in Excel? NotAnExpert Excel Discussion (Misc queries) 1 March 23rd 05 01:17 AM


All times are GMT +1. The time now is 08:19 PM.

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"