VBA Macro Code for Excel 2010
Posted on 2012-03-18
Can you help debug the below macro code? Thanks.
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=IF(ISBLANK(RC[-1]),(VLOOKUP($O2,Sheet2!$A$1:$E$4,2,FALSE),RC[-1])"
I am getting a runtime error 1004 application-defined or object-defined error
I have 4 columns: P, Q, R, & S that need to be populated if they are blank based on the values in a table on a separate sheet, sheet 2 if those values match the data in the cells in column O.
Cells in columns P & Q may be blank, or they may be populated already. If populated, I need to keep that data.
Additionally, this data is updated daily real-time so I need to extract the data from the financial system every 2 - 3 days. After extracting it, I verify the data. However, once verified it is verified. I just need to find the new updated entries, and verify them. So, column R is the verified column and is populated with yes or no. There is a unique ID # in column D so how can I match the new extracted data with the previous day's verified data, and trabsfer the Yes verified to the new extract data in column R?
I have the following code that works great and is similar to what is needed above but it does not involve a vlookup & isblank combination. And, can I make this it's own separate sub (that I can do easily), without any care as to what cell is active prior to calling the sub, or do I need to always get to the proper column (& 1st cell) prior to calling the sub?