![]() |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com