Sheets("Sheet1").Activate crashing VBA code

wackywoo105

New Member
Joined
May 13, 2014
Messages
23
Office Version
  1. 365
Platform
  1. Windows
This happened with access a couple of days ago.
VBA Code:
AppActivate "Access"
started to crash when it has been working forever. I just commented out that line.

Now an excel file with
Code:
Sheets("Sheet1").Activate
is failing at that point.

Can anyone help with why and how to fix it ?

I have to say I'm getting tired of MS updates breaking things that have been working fine for years.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try
VBA Code:
Workbooks("YourWorkbookName.xlsm").Sheets("Sheet1").Activate
. Make sure that you Sheet name is still named Sheet1. Depending on where your Macro resides you could also use
VBA Code:
ThisWorkbook.Sheets("Sheet1").Activate
 
Upvote 0
Solution
Try
VBA Code:
Workbooks("YourWorkbookName.xlsm").Sheets("Sheet1").Activate
. Make sure that you Sheet name is still named Sheet1. Depending on where your Macro resides you could also use
VBA Code:
ThisWorkbook.Sheets("Sheet1").Activate
Thanks. That appears to have done it. I think years of shoddy code is finally catching up with me.

Oddly I had done it the way you said elsewhere, it was just this one line.

Is there a particular reason Excel suddenly doesn't like it?

You don't happen to know an alternative for the Access one do you? (sorry I know wrong place).
 
Upvote 0
Most likely there is another Workbook that opens in the background. Either PERSONAL template, or some add-ins, so you have to specify which Workbook your Sheet is in. Sorry, I don't use Access but you could try
VBA Code:
AppActivate "Microsoft Access"
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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