Hi everyone,
I have a very large workbook that includes a lot of large formulas (approx 40mb). As such, after I update the formulas, I copy/paste values and save the values-only file for distribution. The code I am using is fairly simple (I thought), but is giving me a "Run-time error '1004': Application-defined or object-defined error". Here is my code:
s = EndRow - StartRow + 1
For i = StartRow To EndRow
Range(Cells(i, 1), Cells(i, EndFormulaCol)).Value = Range(Cells(i, 1), Cells(i, EndFormulaCol)).Value
If i Mod 10 = 0 Then
Application.StatusBar = "Progress: " & Format((i - 10) / s, "Percent") & " completed."
DoEvents
End If
Next i
Application.StatusBar = False
The code is breaking on the main action line of "Range(Cells(i, 1), Cells(i, EndFormulaCol)).Value = Range(Cells(i, 1), Cells(i, EndFormulaCol)).Value". I have tried it with and without the "s" variable and the Application.StatusBar section that displays the macros progress as a percent of rows completed. Disabling that section doesn't seem to make a difference. The macro seems to break on the same row everytime, but if I change the data slightly it will break on a different row (and continue to break on that row each time). The .value = .value action seems pretty simple and works fine for 1000+ rows until it breaks. Is there some sort of memory issue that could be causing this? Thanks for the help!
Cross-posted here: http://www.ozgrid.com/forum/showthread.php?t=193619
Bookmarks