VBA to Hide columns

Malhotra Rahul

Board Regular
Joined
Nov 10, 2017
Messages
92
Hi, I have a worksheet tab "Report" in which i want to hide entire columns from AI to ZZ, since there are workings in those columns and i have to keep unprotect the worksheet as well.

Is there any way where i can hide the said columns so the user can not unhide those columns in any manner not even by right click and double click.

Any help would highly be appreciated. Thank you in Advance.
 
Last edited:

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.
You may be able to achieve this if you lock/protect only those columns. Try this:

Select all cells
Right Click (for the menu)
Format Cells
Protection
Then uncheck the "Locked" box.

Now, to lock the specific cells. Follow the same steps as above with one exception. In the final step, CHECK the "Locked" box. Then hide the columns.

From here, you should be able to protect the worksheet. The user(s) will be able to manipulate every other cell, EXCEPT the cells you "Locked".
 
Upvote 0
You may be able to achieve this if you lock/protect only those columns. Try this:

Select all cells
Right Click (for the menu)
Format Cells
Protection
Then uncheck the "Locked" box.

Now, to lock the specific cells. Follow the same steps as above with one exception. In the final step, CHECK the "Locked" box. Then hide the columns.

From here, you should be able to protect the worksheet. The user(s) will be able to manipulate every other cell, EXCEPT the cells you "Locked".

Hi Cornejo, Thank you so much for your support but I am looking for through VBA this part and the reason is I have to keep the the whole worksheet as unprotected.
 
Last edited:
Upvote 0
the reason is I have to keep the the whole worksheet as unprotected
Why? You can protect just certain parts of the sheet, so that they would have access to update and save other things.
Because what you are really asking to do is to "protect" certain parts of the sheets.

The issue with VBA code is that they could simply open the workbook with VBA disabled, and easily beat that strategy.
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,128,027
Members
449,414
Latest member
sameri

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