I have a Macro in an excel sheet that selects a value in a slicer, I had a pivot which was converted to OLAP. When selecting a value in the slicer there is a short period of time where all the cells display ‘########’ before the value is displayed. My trouble is. I have a macro which loops through these values and publishes them as PDF’s. All PDF’s as a result show “#######” in all the cells as when it is looping through the slicer values, it cannot delay the export. I have tried using the Application.Wait (Now + TimeValue("00:00:10"))
but this pauses the workbook and does not allow events to continue in the background. So I had a little check online and come across this little piece of code.
Sub WasteTime(Finish As Long)
Dim NowTick As Long
Dim EndTick As Long
EndTick = GetTickCount + (Finish * 1000)
Do
NowTick = GetTickCount
DoEvents
Loop Until NowTick >= EndTick
End Sub
Which is then called in the loop by WasteTime (10)
. The good news about this is, it appears to let me DoEvents, click in the sheet etc. The bad news about this is, it doesn’t appear to end at all and all the values remain “#######”for well over 10 seconds. Can anyone point me to what I am doing wrong?