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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,247
Messages
6,171,004
Members
452,374
Latest member
keccles

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