View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier[_3_] Roger Govier[_3_] is offline
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