PC Review


Reply
Thread Tools Rate Thread

Clear contents of cells hidden by autofilter

 
 
Philip Reece-Heal
Guest
Posts: n/a
 
      9th Apr 2009
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?

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      9th Apr 2009
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
 
Reply With Quote
 
Philip Reece-Heal
Guest
Posts: n/a
 
      9th Apr 2009
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th Apr 2009
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP: Selecting Non-Visible (Hidden) Cells with AutoFilter Applied west8100 Microsoft Excel Misc 3 11th Feb 2009 11:26 PM
HELP: Selecting Non-Visible (Hidden) Cells when AutoFilter is Appl west8100 Microsoft Excel Worksheet Functions 2 11th Feb 2009 09:20 PM
HELP: Selecting Non-Visible (Hidden) Cells with AutoFilter Applied west8100 Microsoft Excel Misc 0 10th Feb 2009 09:28 PM
HELP: Selecting Non-Visible (Hidden) Cells with AutoFilter Applied west8100 Microsoft Excel Misc 0 10th Feb 2009 09:28 PM
HELP: Selecting Non-Visible (Hidden) Cells with AutoFilter Applied west8100 Microsoft Excel Misc 0 10th Feb 2009 09:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:30 PM.