Forum Discussion
Deleted
Apr 11, 2018Macro has to be run twice
I'm working on an excel file that was designed by someone else. I am only new to VBA. I run the macros previously created to import sheets and data. I then run my simple macro to update three cells t...
Deleted
Apr 11, 2018Thanks for the reply.
That doesn't seem to solve the problem.
I have two buttons on the macro, One runs all of the previously created macros and fills the excel with data from different sheets that it imports, leaving only three cells with #REF.
When I click the second button, It fills the three cells but changes cells previously containing data to #REF.
I click the first button again and now everything has the correct data and I don't have any cells containing #REF.
I am unable to share the workbook.
I hope that my explanation in this reply helps you to understand my problem. Thanks again for your help.
Tomasz Kocur
Apr 11, 2018Brass Contributor
https://support.office.com/en-ie/article/how-to-correct-a-ref-error-822c8e46-e610-4d02-bf29-ec4b8c5ff4be
Go through macro step by step (F8) and observe what and when is happening
Macro Issues
If a macro enters a function on the worksheet that refers to a cell above the function, and the cell that contains the function is in row 1, the function will return #REF! because there are no cells above row 1. Check the function to see if an argument refers to a cell or range of cells that is not valid. This may require editing the macro in the Visual Basic Editor (VBE) to take that situation into account.
Go through macro step by step (F8) and observe what and when is happening
Macro Issues
If a macro enters a function on the worksheet that refers to a cell above the function, and the cell that contains the function is in row 1, the function will return #REF! because there are no cells above row 1. Check the function to see if an argument refers to a cell or range of cells that is not valid. This may require editing the macro in the Visual Basic Editor (VBE) to take that situation into account.