Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Password Protect Unhide Worksheet? | Excel Programming | |||
Unhide, Unprotect, Enter Password | Excel Worksheet Functions | |||
Password to Unhide VeryHidden Sheets | Excel Programming | |||
Hide / Unhide Columns in Password Protected w/s | Excel Programming | |||
how do i unhide password protected rows? | Excel Discussion (Misc queries) |