LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Table Update

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
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
Pivot Table Update Lambi000 Excel Discussion (Misc queries) 1 January 30th 08 08:08 PM
Update Table or Reorder Jeff C Excel Discussion (Misc queries) 3 March 30th 07 09:18 PM
Pivot Table update Talheedin Excel Discussion (Misc queries) 0 August 23rd 06 11:05 AM
VBA to update Pivot table JR Excel Programming 3 May 15th 06 02:01 PM
PLEASE HELP...How do I update a pivot table with VBA? marthasanchez Excel Programming 0 May 10th 06 02:20 PM


All times are GMT +1. The time now is 06:07 PM.

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

About Us

"It's about Microsoft Excel"