LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 80
Default find closest match and copy to sheet1

Joel,

Thank you for responding,

I get syntax error becase this line is in red: closest = rng1)

any idea?
thx.


Joel wrote:
Sub CopyIDData()
Dim rng As Range
Dim rng1 As Range
Dim cell As Range
Dim res As Variant

With Worksheets("sheet1")
Set rng = .Range(.Range("A1"), .Range("A1").End(xlDown))
End With
With Worksheets("Sheet2")
Set rng1 = .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown))
End With

For Each cell In rng
first = true
for each cell1 in Rng1
if first = true then
closest = rng1
first = false
else
if abs(rng - rng1) < abs(rng - closest) then
closest = rng1)
end if
next cell1
cell.Offset(0, 1) = closest
Next
End Sub

Hello,

[quoted text clipped - 55 lines]

Thank you.


--
Message posted via http://www.officekb.com

 
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
Help! Find Closest Coordinate Match Bill Excel Discussion (Misc queries) 6 May 2nd 23 07:42 PM
Find closest text match for each unique entry in a list Nathan_Decker Excel Discussion (Misc queries) 2 September 23rd 07 01:36 AM
Find closest match and copy saman110 via OfficeKB.com Excel Discussion (Misc queries) 3 August 31st 07 06:30 AM
Find the closest match to a reference number in a row of unsorted Nick Krill Excel Worksheet Functions 3 January 1st 06 08:33 PM
find closest match to a reference number in a row of numbers Nick Krill Excel Discussion (Misc queries) 4 December 21st 05 11:59 AM


All times are GMT +1. The time now is 08:54 PM.

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"