Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
MLP MLP is offline
external usenet poster
 
Posts: 6
Default How can I save the formulas when running a macro? Need ASAP!!

I have a simple question...is there a way, via code, to only clear the
contents of a defined range of cells and allow the rest of the worksheet to
remain untouched? Seems simple, but I'm new to macros.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default How can I save the formulas when running a macro? Need ASAP!!

Here is an example of clearing a defined range:

Sub clear_part()
Dim r As Range
Set r = Range("A1:C5")
r.Clear
End Sub

--
Gary's Student


"MLP" wrote:

I have a simple question...is there a way, via code, to only clear the
contents of a defined range of cells and allow the rest of the worksheet to
remain untouched? Seems simple, but I'm new to macros.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default How can I save the formulas when running a macro? Need ASAP!!

If you need to keep formulae and clear only data:

Sub clear_part2()
Dim r As Range
Set r = Range("A1:C5").SpecialCells(xlCellTypeConstants)
r.Clear
End Sub
--
Gary's Student


"MLP" wrote:

I have a simple question...is there a way, via code, to only clear the
contents of a defined range of cells and allow the rest of the worksheet to
remain untouched? Seems simple, but I'm new to macros.

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 do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
Save a Macro ducttape Excel Discussion (Misc queries) 3 February 20th 06 05:46 PM
macro save a workbook whilst increasing file no shrek Excel Worksheet Functions 0 November 10th 05 03:40 PM
Creating a macro to save only partial data Jparsons Excel Discussion (Misc queries) 0 September 24th 05 10:50 AM
Macro to save a file as ynissel Excel Discussion (Misc queries) 4 May 26th 05 02:48 PM


All times are GMT +1. The time now is 08:47 AM.

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"