Hiding Worksheet while copying and pasting

2019-09-18 10:12发布

I am developing some Excel VBA routines that take data from one sheet, generate other workbooks, then copy various sheets and data between them.

I am doing a lot of switching between workbooks/sheets back and forth.

is there a simple way to hide everyting until the end and show some sort of progress bar?

I somply don't want to hide/show things when I need to copy/paste them...I would like excel to do everything silently in background.

Any way to do this??

2条回答
SAY GOODBYE
2楼-- · 2019-09-18 10:39

You can temporarily disable ScreenUpdating

Sub SilentRunning()
    Application.ScreenUpdating = False
    '
    '   do your thing
    '
    Application.ScreenUpdating = True
End Sub
查看更多
Bombasti
3楼-- · 2019-09-18 10:54

@garys-student nailed it on disabling screen updating -- if you want to update a progress bar for particularly antsy users, you can use this:

enter image description here

Application.StatusBar = "Processing row " & Idx & " of " & _
    LastRow & "... " & Format(Idx / LastRow, "0%") & " complete"
'
' do other stuff
'
Application.StatusBar = False 'reset the status bar
查看更多
登录 后发表回答