Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB Code to stop cells being deleted

I would like to write some VB code to stop users deleting the contents of cells in excel. The cells need to be unprotected as users need to input values in them, however, they have formulas in which link to a database. If a user presses the delete button they will remove the formula.

I need to write some code which activates when the delete button is hit. I have written some code, however, can only get it to activate when a button is clicked.

Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default VB Code to stop cells being deleted

How can they input values unless they directly edit the formula?

If your users do actually edit the formula then I suggest you change your
input routine.
Make the input cells values only (which you can leave unlocked) and make
references in the formulas to those cells (which can be locked).

--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



"T Jeanes" <T wrote in message
...
I would like to write some VB code to stop users deleting the contents of

cells in excel. The cells need to be unprotected as users need to input
values in them, however, they have formulas in which link to a database. If
a user presses the delete button they will remove the formula.

I need to write some code which activates when the delete button is hit. I

have written some code, however, can only get it to activate when a button
is clicked.

Can anyone help?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB Code to stop cells being deleted

Thanks for your help. Excel is just the front end of an external database and thus the formulas in the cells relate to references to the database. i.e. when somebody enters 10 they are actually writing 10 to the database.

I need a macro which is running in the backround, like a worksheet event, that will detect if a user hits the delete button. If they press delete I want a message box to appear asking them to instead enter 0.

"Andy Wiggins" wrote:

How can they input values unless they directly edit the formula?

If your users do actually edit the formula then I suggest you change your
input routine.
Make the input cells values only (which you can leave unlocked) and make
references in the formulas to those cells (which can be locked).

--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



"T Jeanes" <T wrote in message
...
I would like to write some VB code to stop users deleting the contents of

cells in excel. The cells need to be unprotected as users need to input
values in them, however, they have formulas in which link to a database. If
a user presses the delete button they will remove the formula.

I need to write some code which activates when the delete button is hit. I

have written some code, however, can only get it to activate when a button
is clicked.

Can anyone help?




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
Remove Cell Color after Code is Deleted [email protected] Excel Discussion (Misc queries) 4 February 20th 07 07:37 PM
How to stop printing the VB Code Result Nadeem Excel Discussion (Misc queries) 0 January 17th 07 06:52 PM
Stop rows from being deleted whilst allowing cells contents to cha SueD Excel Discussion (Misc queries) 2 August 22nd 06 02:59 PM
How do I stop other circles in other cells to stop selecting? stauff Excel Worksheet Functions 2 October 29th 04 09:02 PM
Stop Excel Updating formulas when cells are deleted? tom[_5_] Excel Programming 4 January 23rd 04 09:59 AM


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