Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Clear Content except for Formulas

Hello,
What is the code to clear the content of an entire column, except for the
cells that have formulas?

Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Clear Content except for Formulas

Hi Flo,

Try something like:

'=============
Public Sub Tester()
Dim Rng As Range

Set rng = Columns("A:A") '<<==== CHANGE

On Error Resume Next
Rng.SpecialCells(xlCellTypeConstants).ClearContent s
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman


"Filo" wrote in message
...
Hello,
What is the code to clear the content of an entire column, except for the
cells that have formulas?

Thank you!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear Content except for Formulas


Filo;7553480 Wrote:
Hello,
What is the code to clear the content of an entire column, except for

the
cells that have formulas?


Thank you!


Most of the questions such as yours can easily be answered by recording
a macro TOOLS|MACRO|RECORD NEW MACRO. When I did this on a new
worksheet and selecting the "G" column I got:

Columns("G:G").Select
Selection.ClearContents

Wayne A.


--
rm24746
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Clear Content except for Formulas

Which clears all the cells in column G.

What happened to the cells with formulas being left behind?

Maybe not so easy<g

Next time you are recording go through the steps of selecting just those cells
without formulas before clearing contents.

F5SpecialConstants


Gord Dibben MS Excel MVP


On Mon, 30 Apr 2007 17:16:59 -0500, rm24746
wrote:


Filo;7553480 Wrote:
Hello,
What is the code to clear the content of an entire column, except for

the
cells that have formulas?


Thank you!


Most of the questions such as yours can easily be answered by recording
a macro TOOLS|MACRO|RECORD NEW MACRO. When I did this on a new
worksheet and selecting the "G" column I got:

Columns("G:G").Select
Selection.ClearContents

Wayne A.


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
Clear Cells Content No_Spam Excel Discussion (Misc queries) 2 August 20th 06 04:01 PM
Clear an XML Map of all content DangerMouse[_3_] Excel Programming 1 June 23rd 06 02:43 PM
clear column content owl527[_26_] Excel Programming 2 May 29th 06 01:17 PM
Clear Columns Content Lizz45ie[_7_] Excel Programming 1 November 3rd 05 04:53 PM
Clear the content of a worksheet using VBA Shawshank Excel Programming 3 January 13th 04 03:47 PM


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