Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing a Column range in Multiple Workbooks
I have a command button on Sheet1 which I would like to use to clear
contents in a column range on Sheet1, Sheet2, and Sheet3. How do I do this without Activating Sheet2 and Sheet3? Code in the Sheet1 Module Private Sub cmdClearCol5_Click() ActiveSheet.Range("E11:E1000").ClearContents [sheet2 code??] [sheet3 code??] End Sub Thanks Ruan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clearing a Column range in Multiple Workbooks
Ruan,
Try something like Worksheets("Sheet1").Range("E11:E1000").ClearConte nts Worksheets("Sheet2").Range("E11:E1000").ClearConte nts Worksheets("Sheet3").Range("E11:E1000").ClearConte nts If you want to clear the range on all worksheets, use a loop: Dim WS As Worksheet For Each WS In Worksheets WS.Range("E11:E1000").ClearContents Next WS -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ruan" wrote in message om... I have a command button on Sheet1 which I would like to use to clear contents in a column range on Sheet1, Sheet2, and Sheet3. How do I do this without Activating Sheet2 and Sheet3? Code in the Sheet1 Module Private Sub cmdClearCol5_Click() ActiveSheet.Range("E11:E1000").ClearContents [sheet2 code??] [sheet3 code??] End Sub Thanks Ruan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting/Clearing duplicate range of cells | Excel Worksheet Functions | |||
Named Range: Same Names, Multiple Workbooks with Same Sheet Name | Excel Discussion (Misc queries) | |||
Strange named range issue with multiple workbooks | Excel Discussion (Misc queries) | |||
copy range to multiple workbooks | Excel Discussion (Misc queries) | |||
Accessing/Clearing range in hidden workbook | Excel Programming |