Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() NM, i got it to work! Instead of inserting the rows on the rngItem, inserted the rows one cell below it. But there's something wrong still It works fine for the first sheet, but somehow it stops working for th other sheets. I get "N/A" even though it shouldn't for the rest of the accounts. I there a problem with the "next mysht"? Here's my new code...: For Each mysht In ThisWorkbook.Worksheets With mysht Set rngData = .Range("A71" .Range("A500").End(xlUp)).SpecialCells(xlCellTypeC onstants) End With With Workbooks("Intermediary - PWC").Worksheets("sheet3") Set rngAccounts = .Range("A1:A" & Range("A65536").End(xlUp).Row) End With For i = rngData.Rows(rngData.Rows.Count).Row To _ rngData.Row Step -1 Set rngItem = rngData.Parent.Cells(i, rngData.Column) Set rngout = rngAccounts.Find(What:=rngItem) If rngout Is Nothing Then rngItem.Offset(0, 2).Value = "N/A" Else Set rngcopy = rngout.Offset(0, 1) Set rng = Range(rngcopy, _ rngcopy.End(xlDown).End(xlToRight)) sAdd = rngItem.Address(o, o, xlA1, True) Set rngin = rngItem.Offset(1, 0) rngin.EntireRow.Resize(rng.Rows.Count).Insert xlShiftDown rng.Copy Destination:=Range(sAdd).Offset(0, 2) End If Next i Next mysht End Su -- Sethaholi ----------------------------------------------------------------------- Sethaholic's Profile: http://www.excelforum.com/member.php...fo&userid=2511 View this thread: http://www.excelforum.com/showthread.php?threadid=39395 |