Hi,
I am in the sheet "Line Expenses" iterating through the rows and finding an account... I then take that value and look it up in the "Payroll Entry" Sheet... when it's found, say A30, i have it move over to to Cell, for example K30... I need that location "K30" and throw that into my formula back in the
"Line Expenses" to get = "='APRIL Payroll Entry'!" & oCell1 & ""...
I am getting no where, type mismatch, object required... oh and the ocell.address never works...
Please help
John
VB Code:
Set oBook = ThisWorkbook Set oSheet = oBook.Worksheets("APRIL Line Expenses") For iRow = 25 To 744 '_________________________ 'Column C 'Only some of the accounts on the Line expense reside in the Payroll tab 'if they do then I want the value in the payroll tab to be here If Mid(oSheet.Cells(iRow, 1), 4, 1) = "-" Then Set oCell = oSheet.Cells(iRow, 1) sCell = oCell.Value 'now that i have an account I am going to look up and see if it 'exists in this worksheet Set oSheet1 = oBook.Worksheets("APRIL Payroll Entry") Set oCell1 = Cells.Find(what:=sCell, After:=ActiveCell, lookin:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) Set oCell2 = oCell1.Offset(0, 10) oCell2.Select Set oCell3 = oCell2.Address(RowAbsolute:=True, ColumnAbsolute:=True) 'oCell2.AddressLocal(RowAbsolute:=False, ColumnAbsolute:=False) 'Set oCell1 = oSheet1.Range("A13", Range("A13").End(xlDown)).Find(what:=sCell, lookin:=xlValues) 'oCell1.Offset(0, 10).Address(RowAbsolute:=False, ColumnAbsolute:=False) 'I find the account form the Line expense tab in the Payroll tab 'I want to get its address i.e. K15 and use that for the forumula 'Want column K to be the value in Column C of the April Line Expenses 'sCell2 = oCell2.Offset(0, 10) 'oCell.Offset(0, 2).Activate = "='APRIL Payroll Entry'!" & oCell1 & "" End If Next iRow




Reply With Quote