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

I have two ranges in two sheets within the same workbook that need to be
cross-checked after automatic data replacement. If a value is not found in
range 1 it needs to be appended to range 2. I looked at looping (While ...
< "") but it seems a tad slow. Can soomeone recommend a fast method?

--
Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Crosscheck ranges

Dim rng1 as Range, rng2 as Range
Dim v1 as Variant, rw as Long, i as Long
With Workbooks("Book1.xls").Worksheets(1)
set rng1 = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End With
With Workbooks("Book2.xls").worksheets(1)
set rng2 = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End with
rw = rng2.Rows(rng2.Rows.count).Row + 1

v1 = rng1.Value
for i = lbound(v1,1) to ubound(v1,1)
res = application.Match(v1(i,1),rng2,0)
if iserror(res) then
rng2.parent.Cells(rw,1).Value = v1(i,1)
rw = rw + 1
end if
Next

--
regards,
Tom Ogilvy



"Steve" <No Spam wrote in message ...
I have two ranges in two sheets within the same workbook that need to be
cross-checked after automatic data replacement. If a value is not found in
range 1 it needs to be appended to range 2. I looked at looping (While ...
< "") but it seems a tad slow. Can soomeone recommend a fast method?

--
Steve




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Crosscheck ranges

Tom
Thank you. Works well with very slight mod.
Steve

"Tom Ogilvy" wrote in message
...
Dim rng1 as Range, rng2 as Range
Dim v1 as Variant, rw as Long, i as Long
With Workbooks("Book1.xls").Worksheets(1)
set rng1 = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End With
With Workbooks("Book2.xls").worksheets(1)
set rng2 = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End with
rw = rng2.Rows(rng2.Rows.count).Row + 1

v1 = rng1.Value
for i = lbound(v1,1) to ubound(v1,1)
res = application.Match(v1(i,1),rng2,0)
if iserror(res) then
rng2.parent.Cells(rw,1).Value = v1(i,1)
rw = rw + 1
end if
Next

--
regards,
Tom Ogilvy



"Steve" <No Spam wrote in message ...
I have two ranges in two sheets within the same workbook that need to be
cross-checked after automatic data replacement. If a value is not found
in
range 1 it needs to be appended to range 2. I looked at looping (While
...
< "") but it seems a tad slow. Can soomeone recommend a fast method?

--
Steve






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
how copy formula that contains ranges so ranges do not overlap Patty Excel Worksheet Functions 1 November 20th 08 04:15 PM
Crosscheck values against the list of values. Alok Kumar Excel Worksheet Functions 3 August 10th 07 02:08 PM
Counting variable ranges and auto-summing variable ranges Father Guido[_5_] Excel Programming 2 March 29th 06 04:07 AM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM


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