There could be up to 3 spots to make changes.
Look for the arrows and the line under that question line.
Option Explicit
Sub testme()
Dim wks1 As Worksheet
Dim wks2 As Worksheet
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim res As Variant
Set wks1 = Worksheets("sheet1")
Set wks2 = Worksheets("sheet2")
With wks2
FirstRow = 1
'look at Column C to get the last row? <----
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For iRow = LastRow To FirstRow Step -1
'and use the value in column C <-----
res = Application.Match(.Cells(iRow, "C").Value, _
wks1.Range("a:a"), 0)
If IsError(res) Then
MsgBox "error with row#: " & iRow
Exit Sub
End If
wks1.Cells(res, 2).Insert Shift:=xlToRight
'what column should be brought back to wks1??? <----
wks1.Cells(res, 2).Value = .Cells(iRow, "B").Value
Next iRow
End With
End Sub
phil2006 wrote:
Thanks very much, that's really helped! If my data on sheet two is in
column 3 how do I change the formula?
Thanks again
--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=549543
--
Dave Peterson