Samuel
Samuel

Reputation: 59

Is there a visual difference between ScreenUpdating and Application.Visible?

I'm coding a small programm to extract data from SAP and analyze it in Excel. I'm doing all of this with VBA.

I'm using a function called

Application.ScreenUpdating = False

But whenever i activate a sheet like this

WorkSheets("data_tmp").Activate

it does show on my screen.

So, does the function Activate actually show even when doing the previous ScreenUpdating = False? Are other functions showing on screen even though I'm setting screenupdating to false?

Despite the title, this is not entirely about using active and select - it is more about what shows and what doesnt on screen when setting screenupdating on false, and how to prevent the user of seeing anything at all.

Upvotes: 3

Views: 765

Answers (1)

SmrtGrunt
SmrtGrunt

Reputation: 919

Screen updating is different from visibility.

Setting Application.ScreenUpdating to False will prevent the application from re-drawing the screen each time your function changes something (the exact rate of refresh is not specified, and seems to depend on the overall process load at the time of execution).

If you want to hide the application, use Application.Visible = False before working with the document (don't forget to reverse this at the end of your function). More info can be found at the Microsoft documentation.

As mentioned in the comments and links above, using .Activate and .Select are probably not necessary to accomplish your intent, especially when the application is hidden from view. Instead, refer to specific cells and ranges.

Upvotes: 3

Related Questions