#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default clear cells macro

I am looking to set up a clear button on sheet 1 that when clicked on will
clear various cells on sheet two.

I have a clear button on sheet 1 that when clicked clears cells on sheet 1
that reads;
Range("A1:A77").ClearContents

but when I try to put that cammand button on page one to clear cells on page
two I can't get the proper script that works.

any help is appreciated.

Dorothy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default clear cells macro

Change the command to Worksheets("Sheet2").Range("A1:A77").ClearContents


"Dorothy" wrote in message
...
I am looking to set up a clear button on sheet 1 that when clicked on will
clear various cells on sheet two.

I have a clear button on sheet 1 that when clicked clears cells on sheet 1
that reads;
Range("A1:A77").ClearContents

but when I try to put that cammand button on page one to clear cells on
page
two I can't get the proper script that works.

any help is appreciated.

Dorothy


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default clear cells macro

To be more specific, I am trying to get a clear button on page one that when
clicked will clear all unprotected cells on pages 2, 3 and 4

"Dorothy" wrote:

I am looking to set up a clear button on sheet 1 that when clicked on will
clear various cells on sheet two.

I have a clear button on sheet 1 that when clicked clears cells on sheet 1
that reads;
Range("A1:A77").ClearContents

but when I try to put that cammand button on page one to clear cells on page
two I can't get the proper script that works.

any help is appreciated.

Dorothy

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 118
Default clear cells macro

Dorothy
If it is a Non Contigious range try
Worksheets("Sheet2").Range("A1;A77;B6;D15;G5").Cle arContents

etc,etc,

HTH
Michael M

"Castell" wrote:

Change the command to Worksheets("Sheet2").Range("A1:A77").ClearContents


"Dorothy" wrote in message
...
I am looking to set up a clear button on sheet 1 that when clicked on will
clear various cells on sheet two.

I have a clear button on sheet 1 that when clicked clears cells on sheet 1
that reads;
Range("A1:A77").ClearContents

but when I try to put that cammand button on page one to clear cells on
page
two I can't get the proper script that works.

any help is appreciated.

Dorothy


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default clear cells macro

Sub UnLocked_Cells()
Dim cell As Range, tempR As Range, rangeToCheck As Range
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets(Array _
("Sheet2", "Sheet3", "Sheet4"))
ws.Activate
For Each cell In ActiveSheet.UsedRange
If Not cell.Locked Then
cell.ClearContents
End If
Next cell

Next ws
End Sub

You should get used to referring to worksheets as "sheets" rather than "pages"
which is generally used to designate printed sheets of paper.


Gord Dibben MS Excel MVP


On Sun, 6 Apr 2008 14:39:01 -0700, Dorothy
wrote:

To be more specific, I am trying to get a clear button on page one that when
clicked will clear all unprotected cells on pages 2, 3 and 4

"Dorothy" wrote:

I am looking to set up a clear button on sheet 1 that when clicked on will
clear various cells on sheet two.

I have a clear button on sheet 1 that when clicked clears cells on sheet 1
that reads;
Range("A1:A77").ClearContents

but when I try to put that cammand button on page one to clear cells on page
two I can't get the proper script that works.

any help is appreciated.

Dorothy




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default clear cells macro

But don't use semicolons.

Worksheets("Sheet2").Range("A1,A77,B6,D15,G5").Cle arContents
or maybe
Worksheets("Sheet2").Range("A1:A77,B6:D15,G5").Cle arContents



Michael M wrote:

Dorothy
If it is a Non Contigious range try
Worksheets("Sheet2").Range("A1;A77;B6;D15;G5").Cle arContents

etc,etc,

HTH
Michael M

"Castell" wrote:

Change the command to Worksheets("Sheet2").Range("A1:A77").ClearContents


"Dorothy" wrote in message
...
I am looking to set up a clear button on sheet 1 that when clicked on will
clear various cells on sheet two.

I have a clear button on sheet 1 that when clicked clears cells on sheet 1
that reads;
Range("A1:A77").ClearContents

but when I try to put that cammand button on page one to clear cells on
page
two I can't get the proper script that works.

any help is appreciated.

Dorothy



--

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
how to make a macro to clear multiple cells from multiple worksheets? [email protected] Excel Worksheet Functions 2 October 18th 07 04:31 PM
macro to clear cells press313 Excel Discussion (Misc queries) 0 May 24th 06 02:31 AM
Macro to clear contents of unprotected cells AND drop down boxes JB2010 Excel Discussion (Misc queries) 3 March 30th 06 10:13 AM
Clear shhet with macro Micos3 Excel Discussion (Misc queries) 2 February 20th 06 05:50 PM
Macro to clear cells Esrei Excel Discussion (Misc queries) 5 April 19th 05 01:52 PM


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