Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Filter & clear cells

Hi All,
I am still siting whith a problem with the following:

ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
Selection.AutoFilter Field:=22, Criteria1:="#N/A"
Cells(Range("V5").CurrentRegion.Offset(6,
0).SpecialCells(xlCellTypeVisible).Row, 22).Select
Selection.CurrentRegion.Select
Selection.ClearContents

It worked perfectly well until i have a blank row in between the cells
with "#N/A" in, it filters them all but it does not clear the cells
after the blank row ?

Please can someone help with this.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Filter & clear cells

If the only errors showing in column V are #N/A, then you can try:

On Error Resume Next
columns(22).Specialcells(xlConstants,xlErrors).Cle arContents
columns(22).Specialcells(xlFormulas,xlErrors).Clea rContents
On Error goto 0

Not sure what you are doing with the currentregion, but if you describe what
you are doing, there may be an extension of this that will work.

--
Regards,
Tom Ogilvy


"Tempy" wrote in message
...
Hi All,
I am still siting whith a problem with the following:

ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
Selection.AutoFilter Field:=22, Criteria1:="#N/A"
Cells(Range("V5").CurrentRegion.Offset(6,
0).SpecialCells(xlCellTypeVisible).Row, 22).Select
Selection.CurrentRegion.Select
Selection.ClearContents

It worked perfectly well until i have a blank row in between the cells
with "#N/A" in, it filters them all but it does not clear the cells
after the blank row ?

Please can someone help with this.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Filter & clear cells

Tempy,

To account for the blank row, you need to do it without using the
..Currentregion (and Selection isn't needed, usually).

What is the currentregion around V5? Do you have blank columns anywhere, or
would that statement normally pick up the whole table? What range would
normally be cleared if you didn't have the blank row(s)?

HTH,
Bernie
MS Excel MVP


"Tempy" wrote in message
...
Hi All,
I am still siting whith a problem with the following:

ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
Selection.AutoFilter Field:=22, Criteria1:="#N/A"
Cells(Range("V5").CurrentRegion.Offset(6,
0).SpecialCells(xlCellTypeVisible).Row, 22).Select
Selection.CurrentRegion.Select
Selection.ClearContents

It worked perfectly well until i have a blank row in between the cells
with "#N/A" in, it filters them all but it does not clear the cells
after the blank row ?

Please can someone help with this.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Filter & clear cells

Good morning (South Africa) and evening USA,

Thanks for the replies, the #N/A is a result of a Vlookup and will
always be in Column "V". I then copy the complete column & past the
value to get rid of the formula. It is then that i run the code to get
rid of the #N/A but where i have an instance of #N/A i must also clear
the cells from V:AB ONLY, as the others cells have data in.


Tempy

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Filter & clear cells

On Error Resume Next
set rng = columns(22).Specialcells(xlConstants,xlErrors)
On Error goto 0
If not rng is nothing then
Intersect(Range("V:AB"),rng.EntireRow).ClearConten ts
End If

--
Regards,
Tom Ogilvy


"Tempy" wrote in message
...
Good morning (South Africa) and evening USA,

Thanks for the replies, the #N/A is a result of a Vlookup and will
always be in Column "V". I then copy the complete column & past the
value to get rid of the formula. It is then that i run the code to get
rid of the #N/A but where i have an instance of #N/A i must also clear
the cells from V:AB ONLY, as the others cells have data in.


Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Filter & clear cells

Thank you Tom, this does exactly what i wanted. Tom, could one use this
formula but searching for a value and not an error eg. a 1 or 0 ?
If yes how would one change the code ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
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
How do I clear an Advanced Filter ChipInTampa Excel Worksheet Functions 1 February 28th 10 12:10 PM
The clear filter from a a heading cell is grey out Mark Excel Worksheet Functions 2 September 23rd 09 03:17 AM
Clear Auto Filter on Close (or open) Karin Excel Discussion (Misc queries) 3 August 23rd 07 06:16 PM
How to clear advanced filter in excel Prakash Shukla Excel Discussion (Misc queries) 1 March 16th 07 02:02 PM
Filter & clear cells Tempy Excel Programming 0 April 27th 05 12:49 PM


All times are GMT +1. The time now is 03:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"