Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
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
Deleting/Clearing duplicate range of cells Steve Excel Worksheet Functions 0 April 28th 10 03:59 PM
Named Range: Same Names, Multiple Workbooks with Same Sheet Name BEEJAY Excel Discussion (Misc queries) 4 November 7th 08 03:19 PM
Strange named range issue with multiple workbooks Adam White Excel Discussion (Misc queries) 0 November 14th 06 02:34 AM
copy range to multiple workbooks davez Excel Discussion (Misc queries) 4 August 27th 05 01:14 AM
Accessing/Clearing range in hidden workbook DarrenW Excel Programming 2 July 17th 03 04:00 AM


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