Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Table Update | Excel Discussion (Misc queries) | |||
Update Table or Reorder | Excel Discussion (Misc queries) | |||
Pivot Table update | Excel Discussion (Misc queries) | |||
VBA to update Pivot table | Excel Programming | |||
PLEASE HELP...How do I update a pivot table with VBA? | Excel Programming |