Make one column Invisible.

  • Thread starter Thread starter Neeraja
  • Start date Start date
N

Neeraja

Hi,

Could someone let me know if it is possible to make a
Column in Excel sheet Invisible by VBA Programming.
I need to Hide a Column which contains Data which is
useful for my Programming but not required to be viewed
by the User.

If i hide the column by, for e.g:

Range("N1").Value = "SKU Number"
Columns("N:N").Hidden = True

and then insert the required data into this, the user may
by mistake unhide it or possibly overwrite it somehow. I
dont what this to happen.

Its like i want to make the column invisible and somehow
lock it so that the user will not be able to unhide it.
how do i go about with this???
Thanks in Advance for any help.

Regards,
Neeraja.
 
Use sheet protection. In other words, after hiding the column, use this
line:

ActiveSheet.Protect Password:="cat"

To unprotect, use:

ActiveSheet.Unprotect Password:="cat"

To prevent anyone from seeing the password by simply looking at the VBA
code, right-click the VBAProject(yourfilename) in Project Explorer, select
VBAProject Properties, click on the Protection tab, select "Lock project for
viewing," and give it a password. Then save, close the file, reopen and the
VBA code will be protected from viewing without the password.

Obviously change the password to suit your needs....

MRO
 
Hi,

I dont need to protect the Entire Sheet. The User
actually needs to change the values in a Column. Suppose
there are 2 columns "SKU Number" and "Quantity". The
user should be updating the "Quantity" column and should
not be touching the "SKU Number" Column.

After updating the "Quantity" column the user runs a
Macro which will make use of the values in the "SKU
Number" Column. Actually i am hiding this column. but i
also want to take care that the user by mistake wont
unhide it and change these values.

In a way I dont need to protect my entire
Active Sheet with a Password, i just need to take care of
one Column.

Any help on this would be very grateful.
Thanks,
Neeraja.
 
Why does the SKU column need to be on the same worksheet? You could put it
in a named range on an invisible sheet and refer to it in that range
throughout your macro.
 
Back
Top