LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default empty autofiltered range

Hi All,
I use the following piece of code (I don't repeat here the declarations):

For each cella in otherrng
Range("A1").Select
Selection.AutoFilter Field:=2, Criteria1:=cella
Set txtteljes = ActiveSheet.AutoFilter.Range.Rows
Set txtteljes = txtteljes.Offset(1, 0).Resize(txtteljes.Rows.Count -
1, txtteljes.Columns.Count)
On Error Resume Next
Set txtszurt = txtteljes.SpecialCells(xlVisible)
On Error GoTo 0
If Not txtszurt Is Nothing Then
Selection.Delete Shift:=xlUp
End If
Selection.AutoFilter
Next

My problem is that when range txtszurt is empty (I see on the screen that no
rows are selected), the
If Not txtszurt Is Nothing Then
condition is still met, and all rows are deleted.
What's wrong?

Regards,
Stefi


 
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
Delete some column headings from an autofiltered range. Champ Excel Worksheet Functions 1 February 17th 10 06:39 AM
Test if the range is empty dan Excel Discussion (Misc queries) 6 December 21st 06 03:59 PM
why is range empty? JT Excel Discussion (Misc queries) 1 March 9th 05 12:26 PM
why is range empty? JT[_2_] Excel Programming 3 March 9th 05 06:35 AM
Error stepping through Autofiltered visible range Ed[_9_] Excel Programming 2 January 15th 04 05:34 PM


All times are GMT +1. The time now is 08:31 AM.

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"