PC Review


Reply
Thread Tools Rate Thread

Clear field contents

 
 
CAM
Guest
Posts: n/a
 
      13th Jun 2007
Hello,

I like to write a macro that will clear the content of a sheet only if the
fields has numbers for example 348,000, but not a formula field like =Sum().
Also if the field is a text and have a number I don't want to touch it. Is
this possible? Any tips will be apprecated. Thank you in advance.

Cheers


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      13th Jun 2007
Turn on the macro recorder.
Select your range to clear (include extra surrounding cells)
edit|goto|special
Check Constants
Check Numbers and uncheck Text, Logicals, Errors
click ok

Notice that only the cells with numeric constants in that original selection are
in the selection.

Hit the delete key to clear that.

Tweak your code (if you need to).

Maybe:

On Error Resume Next
'your recorded code
On Error goto 0

Just in case that range doesn't have numeric constants in it.

CAM wrote:
>
> Hello,
>
> I like to write a macro that will clear the content of a sheet only if the
> fields has numbers for example 348,000, but not a formula field like =Sum().
> Also if the field is a text and have a number I don't want to touch it. Is
> this possible? Any tips will be apprecated. Thank you in advance.
>
> Cheers


--

Dave Peterson
 
Reply With Quote
 
CAM
Guest
Posts: n/a
 
      14th Jun 2007
Thanks Dave,

Work like a charm.

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Turn on the macro recorder.
> Select your range to clear (include extra surrounding cells)
> edit|goto|special
> Check Constants
> Check Numbers and uncheck Text, Logicals, Errors
> click ok
>
> Notice that only the cells with numeric constants in that original
> selection are
> in the selection.
>
> Hit the delete key to clear that.
>
> Tweak your code (if you need to).
>
> Maybe:
>
> On Error Resume Next
> 'your recorded code
> On Error goto 0
>
> Just in case that range doesn't have numeric constants in it.
>
> CAM wrote:
>>
>> Hello,
>>
>> I like to write a macro that will clear the content of a sheet only if
>> the
>> fields has numbers for example 348,000, but not a formula field like
>> =Sum().
>> Also if the field is a text and have a number I don't want to touch it.
>> Is
>> this possible? Any tips will be apprecated. Thank you in advance.
>>
>> Cheers

>
> --
>
> Dave Peterson



 
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
clear contents Joanne Microsoft Excel Programming 4 6th Jan 2008 08:48 PM
Clear the contents of a field when form is opened (Access 2003) =?Utf-8?B?SmVycnkgaW4gdGhlIERlc2VydC4=?= Microsoft Access Forms 4 23rd Aug 2007 11:06 PM
Macro to clear range contents when cell contents are changed by us =?Utf-8?B?U3RldmUgRQ==?= Microsoft Excel Programming 12 22nd Feb 2007 09:09 PM
Automatically clear contents of a field louonline Microsoft Access Forms 5 28th Apr 2006 04:05 AM
Clear contents ofg a field after ticking a check box David Sullivan Microsoft Access Queries 1 25th Feb 2004 02:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:32 PM.