Group:  Microsoft Excel ยป microsoft.public.excel.newusers
Thread: VBA password protect

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

VBA password protect
"brian thompson3001 via OfficeKB.com" <u15682[ at ]uwe> 16.07.2006 17:56:22
Hi

I have got this macro to run when opening. All works, but when I password
protect the sheet, and then close and open i get a run error.

I am not fluent with VBA and get by by recording and pasting other work off
the treads

Can anyone let me have the VBA code for protect / unprotect. and where it
should be entered in the code below . The password is "template"

thanks in advance

Private Sub auto_Open()
Sub averagesort()
Range("A6:AI36").Select
Selection.Sort Key1:=Range("C6"), Order1:=xlDescending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlBottomToTop
ActiveWindow.ScrollRow = 6
Range("A3").Select
End Sub


Signature


bnt

--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/excel-new/200607/1
Re: VBA password protect
Dave Peterson <petersod[ at ]verizonXSPAM.net> 16.07.2006 18:23:56
You have a reply at your other post.

"brian thompson3001 via OfficeKB.com" wrote:
[Quoted Text]
>
> Hi
>
> I have got this macro to run when opening. All works, but when I password
> protect the sheet, and then close and open i get a run error.
>
> I am not fluent with VBA and get by by recording and pasting other work off
> the treads
>
> Can anyone let me have the VBA code for protect / unprotect. and where it
> should be entered in the code below . The password is "template"
>
> thanks in advance
>
> Private Sub auto_Open()
> Sub averagesort()
> Range("A6:AI36").Select
> Selection.Sort Key1:=Range("C6"), Order1:=xlDescending, Header:=xlGuess,
> _
> OrderCustom:=1, MatchCase:=False, Orientation:=xlBottomToTop
> ActiveWindow.ScrollRow = 6
> Range("A3").Select
> End Sub
>
> Signature
>
> bnt
>
> --
> bnt
>
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/excel-new/200607/1

--

Dave Peterson

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net