Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default looping through range and deleting cell contents.

Dear all

I'm using excel 97 + a variety of operating systems,

I have a rather large workbook which is full of 64 sheets of formulas, a lot
of the formulas are redundant one month but might be need the following
month. as such the file is over 15 MB in size.

What I have done in order to limit the size, is to put the formulas in row 1
and then if that sheet is need to paste the formula to the relevant cells
(2600 on each sheet.) but a lot of them are still not needed.

What I would like to do is then copy the cells and paste the value into
them, but whenever I try this excel crashes.
(Strangely enough if I try it on excel xp at home it works fine.)

The only work around I can think of is to have a macro to go through the
pasted range and if the value of the formula is zero to change it to zero
rather than have a long formula in there.

any ideas how to go about it, as I'm getting all confused between the
various nows, then and ifs.

many thanks

Andy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default looping through range and deleting cell contents.

Dim rng as Range
Dim sh as Worksheet
for each sh in ThisWorkbook.Worksheets
set rng = sh.Range("A1").CurrentRegion
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
rng.Formula = rng.Value
Next

Converts the formulas to values except in the first row.

--
Regards,
Tom Ogilvy

Andy Healey wrote in message
...
Dear all

I'm using excel 97 + a variety of operating systems,

I have a rather large workbook which is full of 64 sheets of formulas, a

lot
of the formulas are redundant one month but might be need the following
month. as such the file is over 15 MB in size.

What I have done in order to limit the size, is to put the formulas in row

1
and then if that sheet is need to paste the formula to the relevant cells
(2600 on each sheet.) but a lot of them are still not needed.

What I would like to do is then copy the cells and paste the value into
them, but whenever I try this excel crashes.
(Strangely enough if I try it on excel xp at home it works fine.)

The only work around I can think of is to have a macro to go through the
pasted range and if the value of the formula is zero to change it to zero
rather than have a long formula in there.

any ideas how to go about it, as I'm getting all confused between the
various nows, then and ifs.

many thanks

Andy




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
How can I delete the contents of a cell without deleting the formu 6js59 Excel Discussion (Misc queries) 0 June 3rd 08 07:01 PM
Extracting/deleting select data from range of cell DipyDawg Excel Discussion (Misc queries) 4 May 6th 08 06:48 PM
alert before deleting contents of a cell Mortgage Man Excel Discussion (Misc queries) 3 December 15th 06 04:30 PM
Find cell contents in range Nigel Excel Discussion (Misc queries) 7 May 16th 05 01:15 PM
Copy contents of Range to other cell Al[_11_] Excel Programming 10 October 23rd 03 04:45 PM


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

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"