Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Deleting values not formulas

Hi All,
I'm looking for a way to delete cells with values but without formulas in
it? (VBA) in office 2003.
Thanks a lot in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Deleting values not formulas

Hi
For Each c In Selection.Cells
If Not c.HasFormula Then c.ClearContents
Next c

HTH
Cordially
Pascal

"Lp12" a écrit dans le message de news:
...
Hi All,
I'm looking for a way to delete cells with values but without formulas in
it? (VBA) in office 2003.
Thanks a lot in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Deleting values not formulas

Thanks a lot papou.
Thats what I was looking for.
How could I forget .Hasformula!!!!


"papou" wrote:

Hi
For Each c In Selection.Cells
If Not c.HasFormula Then c.ClearContents
Next c

HTH
Cordially
Pascal

"Lp12" a écrit dans le message de news:
...
Hi All,
I'm looking for a way to delete cells with values but without formulas in
it? (VBA) in office 2003.
Thanks a lot in advance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Deleting values not formulas

Another way to get them all at once:

Select the range to fix
Edit|Goto special|Constants
click ok
hit the delete key on the keyboard.

In code:

On error resume next
Selection.Cells.SpecialCells(xlTextValues).ClearCo ntents
on error goto 0

You could specify a more exact range, too:

Activesheet.range("a1:c99").Cells.SpecialCells(xlT extValues).ClearContents

Lp12 wrote:

Hi All,
I'm looking for a way to delete cells with values but without formulas in
it? (VBA) in office 2003.
Thanks a lot in advance


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Deleting values not formulas

Thanks Dave.
This is even more elegant!!!

"Dave Peterson" wrote:

Another way to get them all at once:

Select the range to fix
Edit|Goto special|Constants
click ok
hit the delete key on the keyboard.

In code:

On error resume next
Selection.Cells.SpecialCells(xlTextValues).ClearCo ntents
on error goto 0

You could specify a more exact range, too:

Activesheet.range("a1:c99").Cells.SpecialCells(xlT extValues).ClearContents

Lp12 wrote:

Hi All,
I'm looking for a way to delete cells with values but without formulas in
it? (VBA) in office 2003.
Thanks a lot in advance


--

Dave Peterson

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
Deleting lines that use them for formulas OX_Gambit Excel Discussion (Misc queries) 4 April 2nd 09 01:30 PM
CELLS NOT CALC FORMULAS - VALUES STAY SME FORMULAS CORRECT?? HELP Sherberg Excel Worksheet Functions 4 September 11th 07 01:34 AM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
Excel is Deleting My Formulas?? Carl Bowman Excel Discussion (Misc queries) 2 August 29th 05 09:56 PM
delete values in several cells without deleting the formulas dranreb Excel Discussion (Misc queries) 4 December 9th 04 01:15 AM


All times are GMT +1. The time now is 05:14 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"