Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CP CP is offline
external usenet poster
 
Posts: 64
Default How to delete same column in every sheet

Is it possible to delete the contents of every column H in the whole work
book using a command button
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default How to delete same column in every sheet

For each sh In Activeworkbook.Worksheets
sh.Column(8).ClearContents
Next sh

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"CP" wrote in message
...
Is it possible to delete the contents of every column H in the whole work
book using a command button



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CP CP is offline
external usenet poster
 
Posts: 64
Default How to delete same column in every sheet

Looks like it should work but it doesnt

I created a button, viewed the code and inserted this:

Private Sub Clear_Click()
For Each sh In ActiveWorkbook.Worksheets
sh.Column(8).ClearContents
Next sh

End Sub

The Debug screen shows it failing on sh.Column(8).ClearContents
object doesnt support this method or property


"Bob Phillips" wrote:

For each sh In Activeworkbook.Worksheets
sh.Column(8).ClearContents
Next sh

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"CP" wrote in message
...
Is it possible to delete the contents of every column H in the whole work
book using a command button




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default How to delete same column in every sheet

Hi

try inserting sh.activate immediately inside the loop

Private Sub Clear_Click()
For Each sh In ActiveWorkbook.Worksheets
sh.activate
sh.Column(8).ClearContents
Next sh

End Sub

--
Regards
Roger Govier



"CP" wrote in message
...
Looks like it should work but it doesnt

I created a button, viewed the code and inserted this:

Private Sub Clear_Click()
For Each sh In ActiveWorkbook.Worksheets
sh.Column(8).ClearContents
Next sh

End Sub

The Debug screen shows it failing on sh.Column(8).ClearContents
object doesnt support this method or property


"Bob Phillips" wrote:

For each sh In Activeworkbook.Worksheets
sh.Column(8).ClearContents
Next sh

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"CP" wrote in message
...
Is it possible to delete the contents of every column H in the whole
work
book using a command button






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default How to delete same column in every sheet

I had a typo, it should be


For each sh In Activeworkbook.Worksheets
sh.Columns(8).ClearContents
Next sh



--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"CP" wrote in message
...
Looks like it should work but it doesnt

I created a button, viewed the code and inserted this:

Private Sub Clear_Click()
For Each sh In ActiveWorkbook.Worksheets
sh.Column(8).ClearContents
Next sh

End Sub

The Debug screen shows it failing on sh.Column(8).ClearContents
object doesnt support this method or property


"Bob Phillips" wrote:

For each sh In Activeworkbook.Worksheets
sh.Column(8).ClearContents
Next sh

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"CP" wrote in message
...
Is it possible to delete the contents of every column H in the whole
work
book using a command button








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CP CP is offline
external usenet poster
 
Posts: 64
Default How to delete same column in every sheet

That got it thanks


"Bob Phillips" wrote:

I had a typo, it should be


For each sh In Activeworkbook.Worksheets
sh.Columns(8).ClearContents
Next sh



--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"CP" wrote in message
...
Looks like it should work but it doesnt

I created a button, viewed the code and inserted this:

Private Sub Clear_Click()
For Each sh In ActiveWorkbook.Worksheets
sh.Column(8).ClearContents
Next sh

End Sub

The Debug screen shows it failing on sh.Column(8).ClearContents
object doesnt support this method or property


"Bob Phillips" wrote:

For each sh In Activeworkbook.Worksheets
sh.Column(8).ClearContents
Next sh

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"CP" wrote in message
...
Is it possible to delete the contents of every column H in the whole
work
book using a command button






  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,180
Default How to delete same column in every sheet

Or without VBA...
Select column H
Right-click the tab of that sheet
Select All Sheets Clear Contents

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
Delete rows from one sheet containing deatils on the second sheet [email protected] New Users to Excel 4 September 6th 07 11:10 AM
Delete rows at end of sheet Evan Weiner Excel Discussion (Misc queries) 2 July 11th 07 08:48 PM
delete a sheet is greyed out phil-rge-ee Excel Discussion (Misc queries) 1 May 15th 07 07:00 PM
What if delete sheet is whited out? Peggy Sue Excel Worksheet Functions 2 November 6th 06 05:27 PM
How do I un-delete a sheet? mdorn Excel Discussion (Misc queries) 2 February 4th 05 01:47 AM


All times are GMT +1. The time now is 04:06 PM.

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"