VBA - Remain on 'Active Page'

Peter Muller

Board Regular
Joined
Oct 15, 2018
Messages
133
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

I have a macro that does multiple tasks on different sheets in my workbook.

I have the same macro button on each sheet. When I run the macro, it does what I want it to, but my cursor does not remain on the active sheet, but jumps to a different sheet.


I am looking for code to keep the cursor on the active sheet and not jump to another.

I tried various options, but none works, e.g.,

With ActiveSheet

Range("A1").Select

End With


Please help
 
Try stepping through the code line by line using F8 to see where it changes sheets.
Now I am really baffled. When I step through the code, even a few times, the sheet does not change. When I run the code from the button, it does not change the first time, but when I run it a second time from the button without first running the unprotect macro, it jumps to "Report"
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Are you talking about the code in post#7?
 
Upvote 0
Do you have any event code in the Reports sheet?
 
Upvote 0
In that case I have no idea, as there is nothing in the code you posted that would cause the active sheet to change.
 
Upvote 0
You can always use the approach suggested by richh
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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