wlwebb
asked on
VB for Excel to suspend window updating while updating another workbook
Hello Experts.
I have an Excel workbook that opens a second workbook copies range(s) of info from the 1st workbook finds the last line of input on the 2nd workbook and pastes the values of the info to that 2nd workbook.
It is annoying to see the program open the 2nd workbook and then copy the info to it and save and close that 2nd workbook.
Is there a way in VB to open the second WB in minimized state and do the copy, paste, save and close of that 2nd WB without it flashing on the screen?
I have tried both:
Application.ScreenUpdating = False
Application.WindowState = Excel.XlWindowState.xlMini mized
both ways eventually flash the file on the screen.
I have an Excel workbook that opens a second workbook copies range(s) of info from the 1st workbook finds the last line of input on the 2nd workbook and pastes the values of the info to that 2nd workbook.
It is annoying to see the program open the 2nd workbook and then copy the info to it and save and close that 2nd workbook.
Is there a way in VB to open the second WB in minimized state and do the copy, paste, save and close of that 2nd WB without it flashing on the screen?
I have tried both:
Application.ScreenUpdating
Application.WindowState = Excel.XlWindowState.xlMini
both ways eventually flash the file on the screen.
Application.visible = false will do the trick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well that certainly works. However I fear that it will freak out the clerk when the whole program disappears 6mos from now when there is lots of data and it takes a minute or so to find the bottom of the data to paste the new data to.
Is there any other way that leaves the first wb on an open screen like it is a "frozen" image with a Msgbox saying "updating info please wait"
Is there any other way that leaves the first wb on an open screen like it is a "frozen" image with a Msgbox saying "updating info please wait"
ASKER
Makrini, I tried that, it doesn't work.
ASKER
Makrini, it worked.... as you suspected....
I put the true at the top and the false at the bottom.... DUHHHHHHHHH
How can I get a Msgbox that has a progress bar going while I have that screen updating = false state
I put the true at the top and the false at the bottom.... DUHHHHHHHHH
How can I get a Msgbox that has a progress bar going while I have that screen updating = false state
Without turning screenupdating on again every now and then, its not really possible...
If your Macro is doing a lot of "select" and "Activate" statements your Macro is probably taking a lot longer than it should anyway. Much better to optimise and make it run as fast as possible, then warn the user it could take a minute.
(If you are only pasting one section of data below the rest, we can find the last row in less than a second)
If your Macro is doing a lot of "select" and "Activate" statements your Macro is probably taking a lot longer than it should anyway. Much better to optimise and make it run as fast as possible, then warn the user it could take a minute.
(If you are only pasting one section of data below the rest, we can find the last row in less than a second)
ASKER
Thanks, I read some other "solutions" in the interim and saw that most all experts discouraged a progress bar.
Thank you for the help.
Thank you for the help.
No prob. Have fun with it. The better you get, the faster your macros become and the less problem it is