E
ehtcpa
I have a macro that is generating Excel files. When the macro runs, it saves
two different tabs in the workbooks as values. It needs to test and wait
until the formulas that are pulling amounts from another database are
correctly populated with the amounts.
Right now, I am getting N/A# instead of amounts for some, but not all, of
the files. I think the problem is that the formulas have not completed
pulling the amounts before the macro pastes that tab as zeros. (N/A# is what
appears when the formulas have not completed calculating - once they have
completed, the N/A# is replaced by an amount.)
I am a complete novice to VB. Someone else wrote the macro; one of our
company's IT people has helped me change it, but the errors are still popping
up.
What we have tried includes:
To delay the paste values until sufficient time has elapsed to perform the
calculation:
iDelay = Timer + 120
Do While Timer < iDelay
DoEvents
Loop
To attempt to test the cell for numerical amounts vs. the N/A# error.
bDelay = False
Sheets("Beg Bal - Alea").Activate
Do While bDelay = False
If Not CLng(Range("D15").Value) Then
DoEvents
Else
bDelay = True
End If
Loop
Neither of these work. For example, sometimes companies A11 or A98 or A26
will have an error message and sometimes they won't.
I have over 200 files to generate, therefore I really need this macro to
work consistently and let the calculations happen before it saves values.
Thanks for any help.
two different tabs in the workbooks as values. It needs to test and wait
until the formulas that are pulling amounts from another database are
correctly populated with the amounts.
Right now, I am getting N/A# instead of amounts for some, but not all, of
the files. I think the problem is that the formulas have not completed
pulling the amounts before the macro pastes that tab as zeros. (N/A# is what
appears when the formulas have not completed calculating - once they have
completed, the N/A# is replaced by an amount.)
I am a complete novice to VB. Someone else wrote the macro; one of our
company's IT people has helped me change it, but the errors are still popping
up.
What we have tried includes:
To delay the paste values until sufficient time has elapsed to perform the
calculation:
iDelay = Timer + 120
Do While Timer < iDelay
DoEvents
Loop
To attempt to test the cell for numerical amounts vs. the N/A# error.
bDelay = False
Sheets("Beg Bal - Alea").Activate
Do While bDelay = False
If Not CLng(Range("D15").Value) Then
DoEvents
Else
bDelay = True
End If
Loop
Neither of these work. For example, sometimes companies A11 or A98 or A26
will have an error message and sometimes they won't.
I have over 200 files to generate, therefore I really need this macro to
work consistently and let the calculations happen before it saves values.
Thanks for any help.