PC Review


Reply
Thread Tools Rate Thread

Clearing data from Excel 2003 Form

 
 
berniean
Guest
Posts: n/a
 
      30th Jul 2009
Hi, I have an Excel Form with cells for direct data entry and cells with
formulas. The form is protected so that only those cells for direct data
entry are editable. All the other cells are locked. I want to create a macro
to clear all the data from the unlocked cells. I recorded a macro using the
F5 (goto) function key, the shift key to select contiguous cells, and the
delete key to clear those cells. The problem is, if I move anything on the
form, the cell references in the macro don't change. I have to edit the macro
in the vb editor.

Is there a way to select, in a protected sheet, all unlocked cells and
delete their contents, without using cell references that may change when the
form is changed?

Any help is greatly appreciated,
Bernie
 
Reply With Quote
 
 
 
 
berniean
Guest
Posts: n/a
 
      30th Jul 2009
Thank you for the response. Unfortunately, the first code doesn't work on
protected sheets. The second code started to work but stopped when it hit a
merged cell. I get "Run time error '1004': Cannot change part of a merged
cell." Do you know of a way around that?
Thanks again, Bernie

"p45cal" wrote:

>
> If the cells are for direct entry it's unlikely they'll have a formula
> in so:
>
> Range("E9:H33").SpecialCells(xlCellTypeConstants,
> 7).ClearContents
>
> otherwise to detect unlocked cells:
>
> For Each cll In Range("E9:H33").Cells
> If Not cll.Locked Then cll.ClearContents
> Next cll
>
>
> --
> p45cal
>
> *p45cal*
> ------------------------------------------------------------------------
> p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
> View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=120852
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
clearing data from a user form thomas donino Microsoft Excel Programming 2 6th Aug 2009 06:58 PM
Clearing data in a Form APS Microsoft Access Forms 2 5th Mar 2009 04:39 PM
Clearing data from a form ersouthard Microsoft Access Forms 3 12th Jan 2009 09:01 PM
How to enter excel 2003 data into access 2003 form? =?Utf-8?B?b2Jsb2tv?= Microsoft Access Getting Started 1 29th Jul 2005 05:15 PM
Clearing form's data Randy K. Microsoft Access Forms 2 19th Jul 2003 02:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:04 PM.