Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default function via vb


ive got two worksheets both with approx 20,000 records of various dat
but they both have a unique identifier (i'll call this ref no.) i
sheet A there is a column named dates which doesnt appear in sheet 2.
have been using an offset(match()) formula to look in sheet a for
match on the ref no and if it exists find the associated date and plac
in the new column on sheet B. doing this over all 20,000 records i
sheet b slows down the time it takes to calculate, and all othe
calculations in the book. I figured i might be able to use a vb cod
loop of some sort to carry out the action for me.

please hel

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=52455

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default function via vb

Hello Ceemo,

Here is bit of VBA code you can try and modify for your use.
enjoy Rick

Option Explicit
Sub RefNoDates()

Dim Srng As Range, fndrng As Range
Dim wsA As Worksheet, wsB As Worksheet
Dim iRow As Long

Set wsA = Worksheets("SheetA")
Set wsB = Worksheets("SheetB")

' set range of Ref No's on SheetA, Start at "B2"
' down to "Bxxxxx" , end of ref no's
Set Srng = wsA.Range("B2:B" & wsA.Range("B2").End(xlDown).Row)

' loop thru all ref no's on SheetB
For iRow = 2 To wsB.Range("B2").End(xlDown).Row
' search for ref no
Set fndrng = Srng.Find(what:=wsB.Cells(iRow, "B"))
If Not fndrng Is Nothing Then
' if found, copy date from Column C,
' paste to sheetB Cells(irow,"C")
wsA.Cells(fndrng.Row, "C").Copy wsB.Cells(iRow, "C")
End If
Next iRow

End Sub



"ceemo" wrote in message
...

ive got two worksheets both with approx 20,000 records of various data
but they both have a unique identifier (i'll call this ref no.) in
sheet A there is a column named dates which doesnt appear in sheet 2. I
have been using an offset(match()) formula to look in sheet a for a
match on the ref no and if it exists find the associated date and place
in the new column on sheet B. doing this over all 20,000 records in
sheet b slows down the time it takes to calculate, and all other
calculations in the book. I figured i might be able to use a vb code
loop of some sort to carry out the action for me.

please help


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:

http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=524553



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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


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