Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default selecting the first row after a filtered range

I have a worksheet with information for about 18 nodes. I am able to locate
the data for a particular node and by using AutoFilter I can filter out the
specific row which I require (always a single row). I want to copy this row
to another sheet. xlCellTypeVisible does not work because there is visible
data for other nodes.

Thanks for your help.
Farooq
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default selecting the first row after a filtered range

Hi Farooq,

Try something like:

'=============
Public Sub Tester()
Dim rng As Range
Dim rng2 As Range

Set rng = ActiveSheet.AutoFilter.Range
Set rng = rng.Offset(1).Resize(rng.Rows.Count - 1)

On Error Resume Next
Set rng2 = rng.SpecialCells(xlCellTypeVisible)
On Error Resume Next

If Not rng2 Is Nothing Then
rng2.Copy Destination:=Sheets(1).Range("A1")
End If
End Sub
'<<=============


---
Regards,
Norman


"Farooq Sheri" wrote in message
...
I have a worksheet with information for about 18 nodes. I am able to locate
the data for a particular node and by using AutoFilter I can filter out
the
specific row which I require (always a single row). I want to copy this
row
to another sheet. xlCellTypeVisible does not work because there is visible
data for other nodes.

Thanks for your help.
Farooq



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default selecting the first row after a filtered range

Thank you for pointing out the way. I used the following line in my code and
it worked

Set rng = rng.Offset(1).Resize(rng.Rows.Count - 1)



"Norman Jones" wrote:

Hi Farooq,

Try something like:

'=============
Public Sub Tester()
Dim rng As Range
Dim rng2 As Range

Set rng = ActiveSheet.AutoFilter.Range
Set rng = rng.Offset(1).Resize(rng.Rows.Count - 1)

On Error Resume Next
Set rng2 = rng.SpecialCells(xlCellTypeVisible)
On Error Resume Next

If Not rng2 Is Nothing Then
rng2.Copy Destination:=Sheets(1).Range("A1")
End If
End Sub
'<<=============


---
Regards,
Norman


"Farooq Sheri" wrote in message
...
I have a worksheet with information for about 18 nodes. I am able to locate
the data for a particular node and by using AutoFilter I can filter out
the
specific row which I require (always a single row). I want to copy this
row
to another sheet. xlCellTypeVisible does not work because there is visible
data for other nodes.

Thanks for your help.
Farooq




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
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Max Value within filtered range qed Excel Programming 4 December 15th 04 04:27 AM
traversing through a filtered range based on another filtered range zestpt[_4_] Excel Programming 4 July 12th 04 06:37 PM
Selecting Filtered records only when AutoFilter is on Owen Vickers Excel Programming 4 February 21st 04 02:20 AM
Selecting Filtered Items from Named range Soniya Excel Programming 2 August 20th 03 10:59 AM


All times are GMT +1. The time now is 05:32 AM.

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"