ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA visible property (https://www.excelbanter.com/excel-programming/346485-vba-visible-property.html)

miek

VBA visible property
 
The worksheet "Blank time" visible property is set to xlsheetveryhidden.
The worksheet protection is password protected.
The workbook protection is password protected.

I have the following code:

lDate = Application.InputBox("Enter a date to begin with. Format: mm/dd/yy")
If LCase(lDate) = "false" Then Exit Sub
Worksheets("Blank time").Visible = True ' Runtime error 1004 when pw
protected
Worksheets("Blank time").Select

I get a run time error 1004 on the .visible line when the sheet/workbook is
pass protected. How can I get around this?
thanks


chijanzen

VBA visible property
 

if worksheet protection password is 123
if workbook protection password is 123

try,

With Worksheets("Blank time").
.Parent.Unprotect Password:="123"
.Unprotect Password:="123"
.Visible = True
.Select
End With

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"miek" wrote:

The worksheet "Blank time" visible property is set to xlsheetveryhidden.
The worksheet protection is password protected.
The workbook protection is password protected.

I have the following code:

lDate = Application.InputBox("Enter a date to begin with. Format: mm/dd/yy")
If LCase(lDate) = "false" Then Exit Sub
Worksheets("Blank time").Visible = True ' Runtime error 1004 when pw
protected
Worksheets("Blank time").Select

I get a run time error 1004 on the .visible line when the sheet/workbook is
pass protected. How can I get around this?
thanks



All times are GMT +1. The time now is 01:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com