Clear field contents

  • Thread starter Thread starter CAM
  • Start date Start date
C

CAM

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
 
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.
 
Thanks Dave,

Work like a charm.

Dave Peterson said:
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.
 
Back
Top