Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Comparing Values in Range M

This is from an earlier post that may have been a little
confusing. Let me try again...

I have columns M and N. The initial action will be in
ColumnM. ColumnN looks at the values in ColumnM.

In ColumnM, Values can be added, deleted, or the order in
which the values are listed can be switched around. If
the values in ColumnM are switched around, I dont want
ColumnN to swicth the values to Mirror ColumnM. The only
way the values in ColumnN can be modified is either if a
new value is added to columnM or a value is deleted from
columnM.


Thanx

Todd

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Comparing Values in Range M

Here is one possible interpretation of what you describe:

Sub CompareNtoM()
Dim rngM As Range, rngN As Range
Dim cell As Range, i As Long
Dim res As Variant
Set rngM = Range(Cells(1, "M"), Cells(Rows.Count, "M").End(xlUp))
Set rngN = Range(Cells(1, "N"), Cells(Rows.Count, "N").End(xlUp))
For Each cell In rngM
res = Application.Match(cell, rngN, 0)
If IsError(res) Then
Set rngN = rngN.Resize(rngN.Rows.Count + 1)
rngN(rngN.Rows.Count).Value = cell.Value
End If
Next
Union(rngN, rngM).Select
For i = rngN(rngN.Rows.Count).Row To 1 Step -1
Set cell = Cells(i, "N")
res = Application.Match(cell, rngM, 0)
If IsError(res) Then
cell.Delete Shift:=xlShiftUp
End If
Next

End Sub

--
Regards,
Tom Ogilvy


"Todd Huttenstine" wrote in message
...
This is from an earlier post that may have been a little
confusing. Let me try again...

I have columns M and N. The initial action will be in
ColumnM. ColumnN looks at the values in ColumnM.

In ColumnM, Values can be added, deleted, or the order in
which the values are listed can be switched around. If
the values in ColumnM are switched around, I dont want
ColumnN to swicth the values to Mirror ColumnM. The only
way the values in ColumnN can be modified is either if a
new value is added to columnM or a value is deleted from
columnM.


Thanx

Todd



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
SUMPRODUCT or SUMIF if any values in a range equal any values in another range PCLIVE Excel Worksheet Functions 3 July 15th 09 07:43 PM
Comparing a range of values tamirh Excel Discussion (Misc queries) 3 November 7th 08 10:51 PM
Help with Comparing values and retrieving values in Excel!!!!!! [email protected] Excel Worksheet Functions 1 November 17th 06 12:21 AM
Comparing values between columns only when there are values in bot Mark K Excel Worksheet Functions 1 February 19th 06 06:47 PM
Comparing a Range of Values jpx Excel Discussion (Misc queries) 4 November 22nd 05 10:28 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"