Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Clear contents of cells hidden by autofilter

Have written simple macro to clear contents of all cells in a particular
column. Works fine until some rows on the worksheet are hidden by
autofilter.
I would like to clear contents from all cells in a particular column, even
in rows hidden by autofilter.
Is this possible?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Clear contents of cells hidden by autofilter

I think your choices are to show all the data, clear the range or to loop
through all the cells and clear each cell.



Philip Reece-Heal wrote:

Have written simple macro to clear contents of all cells in a particular
column. Works fine until some rows on the worksheet are hidden by
autofilter.
I would like to clear contents from all cells in a particular column, even
in rows hidden by autofilter.
Is this possible?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Clear contents of cells hidden by autofilter

Thanks Dave

Looping seems to be the only way to go for the worksheet I am working on. I
have found that I have to give each cell address and clear it's contents,
then move onto next.
It's a slow method and another problem is defining the last used row in the
worksheet when the last row/rows are hidden by autofilter. I have tried all
sorts of tricks but can't crack it and have resorted to using an arbitary
quant in the for-next loop.

Any ideas on that?


"Dave Peterson" wrote in message
...
I think your choices are to show all the data, clear the range or to loop
through all the cells and clear each cell.



Philip Reece-Heal wrote:

Have written simple macro to clear contents of all cells in a particular
column. Works fine until some rows on the worksheet are hidden by
autofilter.
I would like to clear contents from all cells in a particular column,
even
in rows hidden by autofilter.
Is this possible?


--

Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Clear contents of cells hidden by autofilter

dim wks as worksheet
dim myCell as range
dim myRng as range
set wks = worksheets("sheet9999")
with wks.autofilter.range.columns(1) 'what column should be cleared
'avoid the header row
set myrng = .resize(.rows.count-1,1).offset(1,0)
end with

for each mycell in myrng.cells
mycell.value = "" 'mycell.clearcontents ???
next mycell

(Untested, uncompiled. Watch for typos.)


Philip Reece-Heal wrote:

Thanks Dave

Looping seems to be the only way to go for the worksheet I am working on. I
have found that I have to give each cell address and clear it's contents,
then move onto next.
It's a slow method and another problem is defining the last used row in the
worksheet when the last row/rows are hidden by autofilter. I have tried all
sorts of tricks but can't crack it and have resorted to using an arbitary
quant in the for-next loop.

Any ideas on that?

"Dave Peterson" wrote in message
...
I think your choices are to show all the data, clear the range or to loop
through all the cells and clear each cell.



Philip Reece-Heal wrote:

Have written simple macro to clear contents of all cells in a particular
column. Works fine until some rows on the worksheet are hidden by
autofilter.
I would like to clear contents from all cells in a particular column,
even
in rows hidden by autofilter.
Is this possible?


--

Dave Peterson


--

Dave Peterson
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
Clear Contents of Specific Cells in Last Row Steve[_4_] Excel Programming 2 March 16th 09 10:18 PM
Clear contents of cells if a condition is met bevchapman Excel Worksheet Functions 2 March 16th 09 03:45 PM
Clear Contents Of Cells Where Value = 0 carl Excel Worksheet Functions 3 July 6th 07 06:02 PM
clear cells unless contents are in bold John Jones Excel Programming 1 August 24th 05 01:07 PM
Clear Contents - NonBold cells Steve Excel Discussion (Misc queries) 3 February 13th 05 11:36 PM


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