G Guest Nov 22, 2007 #1 Is it possible to delete the contents of every column H in the whole work book using a command button
Is it possible to delete the contents of every column H in the whole work book using a command button
B Bob Phillips Nov 22, 2007 #2 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)
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)
G Guest Nov 22, 2007 #3 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
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
R Roger Govier Nov 22, 2007 #4 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
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
B Bob Phillips Nov 22, 2007 #5 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)
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)
G Guest Nov 22, 2007 #6 That got it thanks Bob Phillips said: 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) Click to expand...
That got it thanks Bob Phillips said: 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) Click to expand...
H Herbert Seidenberg Nov 22, 2007 #7 Or without VBA... Select column H Right-click the tab of that sheet