PC Review


Reply
Thread Tools Rate Thread

any function to replace loop

 
 
rumkus@hotmail.com
Guest
Posts: n/a
 
      14th Dec 2006
Below loop works ok. But sheet ("pickuptime2") gets near over 15000
rows and it gets
slower.Any suggestions would be helpful. Thank you very much in
advance.

Sub getpoint(tour As Range, tourdate As Range, hotel As Range)

With Worksheets("pickuptime2")

Set rng1 = .Range("A2", .Range("A" & Rows.count).End(xlUp))

For Each i In rng1
If tour.Value = i.Value And _
tourdate.Value = i.Offset(, 1).Value And _
hotel.Value = i.Offset(, 2) Then

tour.Offset(, 12).Value = i.Offset(, 3)
Exit Sub
End If
Next i

MsgBox " No Value found "

End With

 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      14th Dec 2006
Function getpoint(Tour As Range, TourDate As Range, Hotel As Range)
Dim i As Excel.Range
Dim rng1 As Excel.Range
Dim varAllValues As Variant

varAllValues = Tour.Value & TourDate.Value & Hotel.Value

With Worksheets("pickuptime2")
Set rng1 = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp))
End With

For Each i In rng1
If varAllValues = i.Value & i.Offset(, 1).Value & i.Offset(, 2) Then
Tour.Offset(, 12).Value = i.Offset(, 3)
Exit Function
End If
Next i
MsgBox " No Value found "
End Function
'--
Sub FindThePoint()
Call getpoint(Range("B5"), Range("B6"), Range("B7"))
End Sub
-------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



<(E-Mail Removed)>
wrote in message
Below loop works ok. But sheet ("pickuptime2") gets near over 15000
rows and it gets
slower.Any suggestions would be helpful. Thank you very much in
advance.

Sub getpoint(tour As Range, tourdate As Range, hotel As Range)

With Worksheets("pickuptime2")
Set rng1 = .Range("A2", .Range("A" & Rows.count).End(xlUp))

For Each i In rng1
If tour.Value = i.Value And _
tourdate.Value = i.Offset(, 1).Value And _
hotel.Value = i.Offset(, 2) Then
tour.Offset(, 12).Value = i.Offset(, 3)
Exit Sub
End If
Next i
MsgBox " No Value found "
End With
 
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
Re: I Need to replace many text area in a field with replace function. Smartin Microsoft Access Queries 8 18th Jan 2007 08:01 AM
loop for replace function =?Utf-8?B?bHV6aXBwdQ==?= Microsoft Access Queries 2 24th Mar 2005 10:13 AM
loop on replace function =?Utf-8?B?bHV6aXBwdQ==?= Microsoft Access VBA Modules 2 23rd Mar 2005 01:54 PM
Convert loop with Match function to avoid nested loop??? Kobayashi Microsoft Excel Programming 2 17th Mar 2004 06:36 PM
Replace methode, Replace Function, Stringbuilder replace, Regex Replace, Split Cor Microsoft VB .NET 4 1st Mar 2004 02:50 PM


Features
 

Advertising
 

Newsgroups
 


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