PC Review


Reply
Thread Tools Rate Thread

Compair first 5 numbers

 
 
Srenfro
Guest
Posts: n/a
 
      28th Mar 2008
Hello all i have a question i need to compair only the first 5 or 6 numbers
in Collumn A and Collumn B and put a the result in c I have it to right now
where it will compair the whole list is there a way to get it to do only the
first 5 0r 6 numbers my macro that i have for compairing the whole list is

Sub Find_Matches()
Dim CompareRange As Variant, x As Variant, y As Variant
' Set CompareRange equal to the range to which you will
' compare the selection.
Set CompareRange = Range("A1:A3000")
' NOTE: If the compare range is located on another workbook
' or worksheet, use the following syntax.
' Set CompareRange = Workbooks("Book2"). _
' Worksheets("Sheet2").Range("C1:C5")
'
' Loop through each cell in the selection and compare it to
' each cell in CompareRange.
For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x
End Sub

thank you

Stephen
 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      28th Mar 2008
Hi Stephen

Try this

For Each x In Selection
For Each y In CompareRange
If Left(x, 5) = Left(y, 5) Then x.Offset(0, 1) = x
Next y
Next x

Regards,

Per

"Srenfro" <(E-Mail Removed)> skrev i meddelelsen
news:5CF20239-0181-4C35-8CA3-(E-Mail Removed)...
> Hello all i have a question i need to compair only the first 5 or 6
> numbers
> in Collumn A and Collumn B and put a the result in c I have it to right
> now
> where it will compair the whole list is there a way to get it to do only
> the
> first 5 0r 6 numbers my macro that i have for compairing the whole list is
>
> Sub Find_Matches()
> Dim CompareRange As Variant, x As Variant, y As Variant
> ' Set CompareRange equal to the range to which you will
> ' compare the selection.
> Set CompareRange = Range("A1:A3000")
> ' NOTE: If the compare range is located on another workbook
> ' or worksheet, use the following syntax.
> ' Set CompareRange = Workbooks("Book2"). _
> ' Worksheets("Sheet2").Range("C1:C5")
> '
> ' Loop through each cell in the selection and compare it to
> ' each cell in CompareRange.
> For Each x In Selection
> For Each y In CompareRange
> If x = y Then x.Offset(0, 1) = x
> Next y
> Next x
> End Sub
>
> thank you
>
> Stephen


 
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
compair bbrodsky Microsoft Excel Worksheet Functions 1 11th Aug 2009 06:29 PM
LookUp and compair Stephen sjw_ost Microsoft Access VBA Modules 2 6th May 2009 12:38 AM
Compair tables =?Utf-8?B?TWFoZW5kcmE=?= Microsoft Access 1 10th Oct 2006 05:30 PM
Compair two tables Michelle Microsoft Access Queries 1 16th Jul 2004 03:00 AM
compair 3 fields Jason Frazer Microsoft Access Macros 3 29th Oct 2003 06:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.