Excel slow after vba

lucyvba

New Member
Joined
Jan 30, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hello, I searched for answers but found nothing and this is driving me crazy

I'm making an Workbook to help my workmates to get some info faster from our db

One of my macros is just to change from an worksheet to another worksheet and after I execute it, excel becomes very slow and I can't nearly do anything other than close it and open again. I have larger vba codes and they don't make excel lags like this after I execute them, I wonder what could be causing this

Here my code that makes excel unusable after execution:
VBA Code:
    Worksheets("SCC_Status").Visible = True
    Sheets("SCC_Status").Select
    Worksheets("Inicio").Visible = False

Thanks in advance
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi lucyvba, and welcome.

On it's own that code shouldn't cause Excel to become unresponsive. Is that just a smaller code snippet from a larger routine? If so can you post the rest of the code?

Is there a lot of data in either/both of the Worksheets?

You can try changing the line
VBA Code:
Sheets("SCC_Status").Select
to
VBA Code:
Sheets("SCC_Status").Activate
instead, but that shouldn't really make a difference here.
 
Upvote 0
My code was indeed only these lines.

But your change really saved my Worksheet, OMG!

I changed it to .Activate and now is working totally fine. I even changed it back to .Select and it lagged again. I couldn't never think of this because I have lots of other codes with Sheets("...").Select and they don't lag my excel after executing, I wonder why...

Thank you very much, I still can't believe it's solved
 
Upvote 0
You're welcome :). Thanks for the feedback.

It's generally a bad idea to select anything in code unless you really need to. For reference the following link explains it pretty well...
Difference Between Select and Activate Methods in VBA - Excel Campus

Though I'm not sure why you saw such a performance hit selecting just one sheet. Still, glad you got it fixed.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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