Don't move cursor when running macro

LFCdenmark

New Member
Joined
May 3, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a huge workbook with lots of columns. Some of them are hidden. I have made a simple macro that shows the hidden columns and another macro hiding them again.
In the 1st edition (of the macro) the cursor was send to cell A2 but now the users want the cursor to remain in the same cell it was in before the macro was executed.

Is it possible?
If so, how do I do that?

Here's the "show" macro:
Columns("T:AB").Select
Selection.EntireColumn.Hidden = False
Range("A2").Select

I have tried with these commands as well:
ActiveCell.Offset(1).Select
ActiveCell.Offset(-1).Select
but with no effect.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi & welcome to MrExcel.
How about
VBA Code:
Columns("T:AB").EntireColumn.Hidden = False
 
Upvote 0
Solution
Hi Fluff
You're my hero! ?
It works as intended and has now been implemented in the workbook mentioned.
Much appreciated ?
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,846
Members
449,194
Latest member
HellScout

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