Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Unhide Columns With A Password

I am trying to create a small marco that unhides a few columns in excel, but
prompts for a password. Is this possible?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Unhide Columns With A Password

It is possible with an inputbox.

Sub unhide()
pword = InputBox("enter the password")
If pword < "mypass" Then
MsgBox "incorrect password"
Exit Sub
Else
ActiveSheet.Range("A:A,C:C,D:D").EntireColumn.Hidd en = False
End If
End Sub

BUT...........without protecting the sheet, placing a password on a macro
would prove to be sort of useless.

Users could unhide the columns without using your macro.

Protect the sheet with columns hidden and a password to unprotect.

Users will have to know the password.

Also be warned that Excel's internal passwords are eaty to crack.


Gord Dibben MS Excel MVP

On Wed, 3 Mar 2010 15:44:34 -0000, "Jim" wrote:

I am trying to create a small marco that unhides a few columns in excel, but
prompts for a password. Is this possible?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Unhide Columns With A Password

Thanks for the reply. I think I have come up with a solution by using a
macro to unhide, but prompting to unlock the sheet with a password.

So, to hide the given cells, user hits a button with a macro, this hides the
relevant columns and locks the sheet. I does allow the user to format cells
etc.

Then the second button executes second macro, and this then prompts a
password to unprotect the sheet and then unhides. Now I just need to hide
the code from any sneaky users!

Macro 1

Columns("L:O").Select
Selection.EntireColumn.Hidden = True
Range("A1").Select

ActiveSheet.EnableOutlining = True
ActiveSheet.Protect Password:="password", _
DrawingObjects:=True, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=False, _
AllowFormattingRows:=True, AllowInsertingColumns:=True,
AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True,
_
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True

Macro 2

ActiveSheet.Unprotect
Columns("K:P").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
It is possible with an inputbox.

Sub unhide()
pword = InputBox("enter the password")
If pword < "mypass" Then
MsgBox "incorrect password"
Exit Sub
Else
ActiveSheet.Range("A:A,C:C,D:D").EntireColumn.Hidd en = False
End If
End Sub

BUT...........without protecting the sheet, placing a password on a macro
would prove to be sort of useless.

Users could unhide the columns without using your macro.

Protect the sheet with columns hidden and a password to unprotect.

Users will have to know the password.

Also be warned that Excel's internal passwords are eaty to crack.


Gord Dibben MS Excel MVP

On Wed, 3 Mar 2010 15:44:34 -0000, "Jim" wrote:

I am trying to create a small marco that unhides a few columns in excel,
but
prompts for a password. Is this possible?

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Unhide Columns With A Password

Alt + F11 to go to VBE

Select your workbook/project.

Right-clickVBAProject PropertiesProtectionLock for viewing.

Enter a password twice and don't forget it.

Save and close workbook.


Gord

On Thu, 4 Mar 2010 09:49:23 -0000, "Jim" wrote:

Then the second button executes second macro, and this then prompts a
password to unprotect the sheet and then unhides. Now I just need to hide
the code from any sneaky users!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Unhide Columns With A Password

Thanks Gord

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Alt + F11 to go to VBE

Select your workbook/project.

Right-clickVBAProject PropertiesProtectionLock for viewing.

Enter a password twice and don't forget it.

Save and close workbook.


Gord

On Thu, 4 Mar 2010 09:49:23 -0000, "Jim" wrote:

Then the second button executes second macro, and this then prompts a
password to unprotect the sheet and then unhides. Now I just need to hide
the code from any sneaky users!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Protect Unhide Worksheet? garyh[_2_] Excel Programming 12 February 27th 13 01:52 PM
Unhide, Unprotect, Enter Password Don[_3_] Excel Worksheet Functions 2 January 20th 10 03:20 PM
Password to Unhide VeryHidden Sheets ryguy7272 Excel Programming 7 June 4th 08 03:59 PM
Hide / Unhide Columns in Password Protected w/s monir Excel Programming 2 January 12th 08 12:44 AM
how do i unhide password protected rows? RhondaJ Excel Discussion (Misc queries) 2 May 4th 05 12:02 AM


All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"