Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Unhide, Unprotect, Enter Password

Hi,

I think this is probably fairly simply and I thought it would have
recorded when I recorded the macro but it didn't.

I have to have the macro unhide a worksheet, unprotect it, enter the
password, paste some data, re-protect it, and re-enter the pssword
twice to confirm, all without addditional user input because the user
will not know the password.

When I recorded this is what I got but it is prompting for the
password. After lines 2 and 11 are where I need some type of auto
password entry .

Sheets("Ledger").Visible = True
ActiveSheet.Unprotect
Sheets("Clerk Entry").Select
Cells.Select
Selection.Copy
ActiveWindow.ScrollWorkbookTabs Sheets:=-10
Sheets("Ledger").Select
Cells.Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveWindow.SelectedSheets.Visible = False
Sheets("PS 3083").Select
Range("A1:AO1").Select
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Unhide, Unprotect, Enter Password

Don,

You don't need to make the sheet visible to write to it and there's no need
to select either. So your code can be abbreviated to this. Change "MyPass" to
your password

Sheets("Ledger").Unprotect PassWord:="MyPass"
Sheets("Clerk Entry").UsedRange.Copy _
Destination:=Sheets("Ledger").Range("A1")
Application.CutCopyMode = False
Sheets("Ledger").Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, PassWord:="MyPass"

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Don" wrote:

Hi,

I think this is probably fairly simply and I thought it would have
recorded when I recorded the macro but it didn't.

I have to have the macro unhide a worksheet, unprotect it, enter the
password, paste some data, re-protect it, and re-enter the pssword
twice to confirm, all without addditional user input because the user
will not know the password.

When I recorded this is what I got but it is prompting for the
password. After lines 2 and 11 are where I need some type of auto
password entry .

Sheets("Ledger").Visible = True
ActiveSheet.Unprotect
Sheets("Clerk Entry").Select
Cells.Select
Selection.Copy
ActiveWindow.ScrollWorkbookTabs Sheets:=-10
Sheets("Ledger").Select
Cells.Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveWindow.SelectedSheets.Visible = False
Sheets("PS 3083").Select
Range("A1:AO1").Select
.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Unhide, Unprotect, Enter Password

'Here is your code with proper protection password callouts:

With Sheets("Ledger")
.Visible = True
.Unprotect Password:= "MyPassword"
Sheets("Clerk Entry").Cells.Copy
.Cells.Select
.Paste
Application.CutCopyMode = False
.Protect Password:= "MyPassword", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
.Visible = False
End With
Sheets("PS 3083").Range("A1:AO1").Select



--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Don" wrote:

Hi,

I think this is probably fairly simply and I thought it would have
recorded when I recorded the macro but it didn't.

I have to have the macro unhide a worksheet, unprotect it, enter the
password, paste some data, re-protect it, and re-enter the pssword
twice to confirm, all without addditional user input because the user
will not know the password.

When I recorded this is what I got but it is prompting for the
password. After lines 2 and 11 are where I need some type of auto
password entry .

Sheets("Ledger").Visible = True
ActiveSheet.Unprotect
Sheets("Clerk Entry").Select
Cells.Select
Selection.Copy
ActiveWindow.ScrollWorkbookTabs Sheets:=-10
Sheets("Ledger").Select
Cells.Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveWindow.SelectedSheets.Visible = False
Sheets("PS 3083").Select
Range("A1:AO1").Select
.

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
Creating Macro to Unprotect and unhide Mandy Excel Discussion (Misc queries) 2 August 7th 08 12:29 PM
How do I unprotect a workbook without the password? FJBSD Excel Discussion (Misc queries) 1 March 29th 08 11:49 PM
Unprotect password- forgot? JW Excel Worksheet Functions 4 February 29th 08 04:56 AM
how can i unprotect worksheet with no password? raf Excel Discussion (Misc queries) 2 May 21st 07 09:25 PM
I need to unprotect a worksheet but I don't have the password. FarrShadow Excel Discussion (Misc queries) 3 October 29th 06 02:02 AM


All times are GMT +1. The time now is 10:31 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"