Excel VBA relection bug

Starkand

New Member
Joined
Apr 19, 2018
Messages
4
Hi,

I have the weirdest bug. I have a simple macro that goes like this:

Code:
Sub Update()

        Application.Calculation = xlManual
    ActiveWorkbook.RefreshAll
    Range("A20").Select
        Application.Calculation = xlAutomatic

End Sub

When I use this code, all goes well, but I later get a sort of a reflection from one of the other worksheets in the one I am working on. This is very annoying, it typically overshadows what I am working on, especially when I input new data in tables. Here is an image showing the problem:

Refl.jpg

I would very much appreciate help with this!

/ Erling
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Welcome to the forum. It is probably occurring because the refreshall is carrying on in the background after the macro finishes. Refreshall does not wait for all refreshes to complete, so results coming in may be causing it. If you put this extra line in like this:
VBA Code:
Sub Update()

        Application.Calculation = xlManual
    ActiveWorkbook.RefreshAll
    Application.CalculateUntilAsyncQueriesDone
    Range("A20").Select
        Application.Calculation = xlAutomatic

End Sub
then the macro will stop until all background refreshes have completed. If, on the other hand, you want to be able to carry on while th refreshes are still going on, then I think you will always stand a chance of 'ghosting'.
 
Upvote 0
Why are you switching to manual rather than using just .Calculate?
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,580
Members
449,039
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top