Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please correct for me this code
Hi guys -I would like to compare to columns (A, S) , for exemple A2 with the hole of S until the lastrow -and if for exemple A2 = S10, then I like to put all the row (M10, N10 O10, P 10, Q 10 and R10) in another coloumn X2. This the code I did but it doesnot work please coreect ift for me i you could (please stay simple because I am new in Macros) Sub comparetwocoloumns() ' ' Dim rng As Range, i As Long, LastRow As Long, res As Variant Range("S2").Select LastRow = Selection.End(xlDown).Select Application.WindowState = xlMinimized Application.WindowState = xlNormal For i = 2 To LastRow res = Application.Match("A & i : A & LastRow", "S & i", 0) If Not IsError(res) Then Cells("X & i").Value = _ Cells("M & i: R & i").Value End If Next i End Sub many thanks for the hel -- Freeman_10 ----------------------------------------------------------------------- Freeman_100's Profile: http://www.excelforum.com/member.php...fo&userid=3320 View this thread: http://www.excelforum.com/showthread.php?threadid=53202 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please correct for me this code | Excel Programming | |||
Please Help Correct my code | Excel Programming | |||
is this vba code correct or is there a more simple way to do this ? | Excel Programming | |||
Code is not correct | Excel Programming | |||
Help to correct code | Excel Programming |