Glasgowsmile
Active Member
- Joined
- Apr 14, 2018
- Messages
- 280
- Office Version
- 365
- Platform
- Windows
Good morning,
I'm running into an issue with the following code. I am attempting to open a source document, add these formulas to that document and then extract the results of those formulas. The problem (I think) is that the source document is horrible optimized and runs really slowly so this VBA works before the cells have populated correctly in the source document which often leads to the retrieved data being 0. Is there a way I can prevent this code from loading until that document has finished loading in the background?
I'm running into an issue with the following code. I am attempting to open a source document, add these formulas to that document and then extract the results of those formulas. The problem (I think) is that the source document is horrible optimized and runs really slowly so this VBA works before the cells have populated correctly in the source document which often leads to the retrieved data being 0. Is there a way I can prevent this code from loading until that document has finished loading in the background?
VBA Code:
Sheets("Cover").Range("D36").Formula = "=(AL5/Q36)*1"
Sheets("Cover").Range("D38").Formula = "=SUM(AL5:AS5)"
Sheets("Cover").Range("D39").Formula = "=(D38/Q36)*1"
With Sheet8
nextRow = .Range("B" & .Rows.Count).End(xlUp).Row + 1
.Cells(nextRow, "B").Value = Sheets("Cover").Range("Q36").Value
.Cells(nextRow, "C").Value = Sheets("Cover").Range("C38").Value
.Cells(nextRow, "D").Value = Sheets("Cover").Range("C39").Value
.Cells(nextRow, "E").Value = Sheets("Cover").Range("D36").Value
.Cells(nextRow, "F").Value = Sheets("Cover").Range("D39").Value
.Cells(nextRow, "H").Value = Sheets("Cover").Range("S4").Value
.Cells(nextRow, "I").Value = Sheets("Cover").Range("S5").Value
End With