Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Clearing cells of numbers, but not cell references.

I have several ranges on several sheets which contain a mixture of
a) numbers in the form of: 123
b) numbers in the form of: =123+456 (resulting in 579)
c) formulae in the form of: =sum(A1:A20)
d) formulae in the form of: =A30+A40+A50 etc..

Each month I need to clear the numbers in categories a & b, but leave
the formulae in categories c & d

What's the simplest and quickest way of achieving this?

Is it a macro which loops through all the cells testing to see whether
the cell should be cleared, or is there a more elegant solution.

If a looping macro, can someone suggest what the test should be
please?

Many thanks,

Richard Buttrey
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Clearing cells of numbers, but not cell references.

Richard, since category b is a formula like c&d, you can't test for 'has
formula'. If the a&b types of data always appear in a certain range of cells
on each worksheet, I would take the time to write some code that would
'ClearContents' of those ranges for each sheet.

Sub Reset ()
Sheet1.Range("A1:A20,A33:A200,B2:F45").ClearConten ts
Sheet1.Columns("G:I").ClearContents
Sheet1.Rows("201:300").ClearContents
Sheet2.Range....etc
Sheet3.Range....etc
End Sub

Use code like the above to clear the cells around the c&d types you want to
keep.

Mike F

"Richard Buttrey" wrote in message
om...
I have several ranges on several sheets which contain a mixture of
a) numbers in the form of: 123
b) numbers in the form of: =123+456 (resulting in 579)
c) formulae in the form of: =sum(A1:A20)
d) formulae in the form of: =A30+A40+A50 etc..

Each month I need to clear the numbers in categories a & b, but leave
the formulae in categories c & d

What's the simplest and quickest way of achieving this?

Is it a macro which loops through all the cells testing to see whether
the cell should be cleared, or is there a more elegant solution.

If a looping macro, can someone suggest what the test should be
please?

Many thanks,

Richard Buttrey



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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing numbers in excel Kevin W[_2_] Excel Discussion (Misc queries) 3 September 9th 08 02:43 PM
how to replace cell references with actual numbers [email protected] Excel Discussion (Misc queries) 5 November 21st 06 02:27 PM
How can SUM use cell references in other cells? Phil G Excel Discussion (Misc queries) 3 March 24th 06 10:02 AM
Can I use HEX2DEC with cell references vs. numbers? cjssas Excel Worksheet Functions 8 September 12th 05 07:45 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"