Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Sheet protection

Hi,

My workbook is running. Now I'm trying to add my protection into the
sheets.

As a new item is added to the list on the main page, a new sheet is created
by copying a template and placing the appropriate formulas to link the new
sheet with the main page.

I add the unprotect/protect and the routine gives me a 1004 error.

When check my variable, it is correct.

I have tried this without setting the worksheet and with setting the
worksheet. I still get the same results. What baffles me is it works until
I add the protection. Is there something I don't understand? I need to add
the unprotect/protect in each routine, correct?

here's my code:

Sub SaveTenantName(Choice)

Dim ws As Worksheet

Set ws = MainPagepg
MainPagepg.Unprotect (MyPassword)

With ws

'save Tenants Name
With Cells(Choice, 6)
.NumberFormat = "General"
.Value = frmStoreData.txtTenantName.Value
End With

End With

MainPagepg.Protect ([MyPassword]), AllowFormattingCells:=True

End Sub
--
Thanks for your help.
Karen53
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Sheet protection

Karen,

Have you tired sheets(MainPagepg).unprotect rather than just
mainPagepg.unprotect?

Regards,
Clint

"Karen53" wrote in message
...
Hi,

My workbook is running. Now I'm trying to add my protection into the
sheets.

As a new item is added to the list on the main page, a new sheet is
created
by copying a template and placing the appropriate formulas to link the new
sheet with the main page.

I add the unprotect/protect and the routine gives me a 1004 error.

When check my variable, it is correct.

I have tried this without setting the worksheet and with setting the
worksheet. I still get the same results. What baffles me is it works
until
I add the protection. Is there something I don't understand? I need to
add
the unprotect/protect in each routine, correct?

here's my code:

Sub SaveTenantName(Choice)

Dim ws As Worksheet

Set ws = MainPagepg
MainPagepg.Unprotect (MyPassword)

With ws

'save Tenants Name
With Cells(Choice, 6)
.NumberFormat = "General"
.Value = frmStoreData.txtTenantName.Value
End With

End With

MainPagepg.Protect ([MyPassword]), AllowFormattingCells:=True

End Sub
--
Thanks for your help.
Karen53



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
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Q about sheet protection TheMilkGuy Excel Discussion (Misc queries) 2 July 4th 09 04:52 PM
sheet protection Pa Maher Excel Worksheet Functions 1 April 8th 08 11:24 PM
Sheet protection error msg - Unrequested sheet activation deltree[_3_] Excel Programming 0 January 28th 04 06:20 PM


All times are GMT +1. The time now is 06:44 AM.

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

About Us

"It's about Microsoft Excel"