Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default help with listing data

Hi Bradley

This runs like lightning. I would change the cell you want to use as
your criteria to be a variable then its all down hill.

Take care

Marcus

Sub findit()
'Make 123456 a variable
Find_Range(123456, Columns("B"), xlFormulas, xlWhole). _
EntireRow.Copy Range("Sheet2!B65536").End(xlUp).Offset(1, 0).EntireRow
End Sub


Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range
Dim c As Range

If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
If IsMissing(MatchCase) Then MatchCase = False

With Search_Range
Set c = .Find(What:=Find_Item, LookIn:=LookIn, _
LookAt:=LookAt, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstAddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default help with listing data

I'm afraid I have a stupid question. How do I set up the cell with the
client ID# (in my example, 123456) as a variable? Will your suggestion work
if I have thousands of different client ID#s?

Thanks--sorry for getting back so late after your reply.


"marcus" wrote:

Hi Bradley

This runs like lightning. I would change the cell you want to use as
your criteria to be a variable then its all down hill.

Take care

Marcus

Sub findit()
'Make 123456 a variable
Find_Range(123456, Columns("B"), xlFormulas, xlWhole). _
EntireRow.Copy Range("Sheet2!B65536").End(xlUp).Offset(1, 0).EntireRow
End Sub


Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range
Dim c As Range

If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
If IsMissing(MatchCase) Then MatchCase = False

With Search_Range
Set c = .Find(What:=Find_Item, LookIn:=LookIn, _
LookAt:=LookAt, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstAddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Function
.

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
pulling data from one sheet and listing selected data in another Bfly Excel Worksheet Functions 2 February 2nd 07 01:38 AM
listing and selecting data parthi_75 Excel Worksheet Functions 0 November 3rd 05 12:21 PM
Listing data Jai Excel Discussion (Misc queries) 0 August 18th 05 06:01 PM
selecting and listing data Brian Excel Worksheet Functions 9 November 9th 04 06:55 PM
Data mix and listing Tom Ogilvy Excel Programming 2 September 5th 03 04:36 AM


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