Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Compare Col A and Col M, if Match, Copy Col N to Col E

I'm trying to get this macro to compare values in Column A and Column M,
starting in Cell(2, 13), and if there is a match, copy the value from Column
N (that corresponds to Column M) into Column E. For instance, 4/1/2008 is
in Cell A1 (and the dates go down consecutively). I have 4/6/2008 in M2 and
5,000,000 in N2. How can I get 5,000,000 into E6 (A6 contains 4/6/2008)?
Confused yet? I am.

Sub MatchAandM()
Dim Lrow As Long
Dim Rng As Range, i As Range, xRng As Range

Lrow = Range("A65536").End(xlUp).Row
Set Rng = Range(Cells(2, 13), Cells(Lrow, 2))

For Each i In Rng
Set xRng = Rng.Find(What:=i.Offset(0, -1).Value, _
LookIn:=xlValues, MatchCase:=False)
If xRng Is Nothing Then
'Else
i.Offset(0, -1).Copy i.Offset(0, 1)
End If
Next i

End Sub


Thanks for the help; I truly appreciate it.

Regards,
Ryan--
RyGuy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Compare Col A and Col M, if Match, Copy Col N to Col E

Whoops! Just realized I posted to the excel-Functions group. I'm going over
to the Excel-Programming group now...
--
RyGuy


"ryguy7272" wrote:

I'm trying to get this macro to compare values in Column A and Column M,
starting in Cell(2, 13), and if there is a match, copy the value from Column
N (that corresponds to Column M) into Column E. For instance, 4/1/2008 is
in Cell A1 (and the dates go down consecutively). I have 4/6/2008 in M2 and
5,000,000 in N2. How can I get 5,000,000 into E6 (A6 contains 4/6/2008)?
Confused yet? I am.

Sub MatchAandM()
Dim Lrow As Long
Dim Rng As Range, i As Range, xRng As Range

Lrow = Range("A65536").End(xlUp).Row
Set Rng = Range(Cells(2, 13), Cells(Lrow, 2))

For Each i In Rng
Set xRng = Rng.Find(What:=i.Offset(0, -1).Value, _
LookIn:=xlValues, MatchCase:=False)
If xRng Is Nothing Then
'Else
i.Offset(0, -1).Copy i.Offset(0, 1)
End If
Next i

End Sub


Thanks for the help; I truly appreciate it.

Regards,
Ryan--
RyGuy

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
Compare col and match then copy and paste saman110 via OfficeKB.com Excel Discussion (Misc queries) 2 February 21st 08 12:28 AM
compare and match test LITTLE PETE Excel Worksheet Functions 1 November 9th 07 03:24 PM
How to match and compare two spreadsheets Brad Excel Worksheet Functions 1 June 28th 07 09:32 AM
compare & match text Susanne Excel Worksheet Functions 5 May 22nd 07 05:34 PM
Compare and Match Functions DP63 Excel Discussion (Misc queries) 1 June 20th 06 04:00 PM


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