Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to protect all sheet ?


hi everyone,

i have 2 questions here

i have file, but i do not know how many sheet are there in before

1) how to use VBA to protect all sheet with password ?

2) how to use VBA to copy value of C4 to name of all sheet, if per C4
have same value, it must popup mSg 'Error'

- Is there a way to integrate 1 and 2 become one function.

thank you for help


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=567884

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 108
Default How to protect all sheet ?


vumian wrote:
hi everyone,

i have 2 questions here

i have file, but i do not know how many sheet are there in before

1) how to use VBA to protect all sheet with password ?

2) how to use VBA to copy value of C4 to name of all sheet, if per C4
have same value, it must popup mSg 'Error'

- Is there a way to integrate 1 and 2 become one function.

thank you for help


--
vumian


Hi vumian

1)

Sub ProtectAllSheets()
Dim sht As Worksheet
For Each sht In Worksheets
sht.Protect
Next
End Sub

2) Can be added to the code above with

sht.Name = Range("C4").Value

but why is it going to fail? Is there a likely to be a duplicate
value, illegal characters or both?

Note: the opposite of .Protect is .Unprotect

Regards

Steve

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 108
Default How to protect all sheet ?


Scoops wrote:
2) Can be added to the code above with

sht.Name = Range("C4").Value

Should be sht.Name = sht.Range("C4").Value

Regards

Steve

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to protect all sheet ?


hi man,

ok if it corrects, AND HOW ABOUT THE DUPLICATE NAME OF C4 FOR NAME TO
SHEET.
maybe let's popup msgbox here to info error.

how to do it.

regards


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=567884

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default How to protect all sheet ?

Adapt this to your needs.

Sub Sheetname_cell()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
On Error Resume Next
sh.Name = sh.Range("C4").Value
'next lines cover duplicate names

If Err.Number 0 Then
MsgBox "Change the name of : " & sh.Name & " manually"
Err.Clear
End If
On Error GoTo 0

Next
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Thu, 3 Aug 2006 12:23:48 -0400, vumian
wrote:


hi man,

ok if it corrects, AND HOW ABOUT THE DUPLICATE NAME OF C4 FOR NAME TO
SHEET.
maybe let's popup msgbox here to info error.

how to do it.

regards




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to protect all sheet ?


hi Gord Dibben,

it's so great, that is a code which i need :) ;)

thank you very much.


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=567884

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to protect all sheet ?


hi man,

your code so great,

and now, per sheet i have 1 picture, but i do not wanna lock it, it is
normal

how to do it

thanks in advance


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=567884

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
Password protect a sheet without Macros Cappa Excel Discussion (Misc queries) 3 May 27th 06 01:49 AM
Asked previously...can this not be done in excel simonsmith Excel Discussion (Misc queries) 2 May 16th 06 11:50 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
when I protect my sheet enter tab, & arrow keys dont work... greg Excel Discussion (Misc queries) 0 May 25th 05 03:30 PM
Naming & renaming a sheet tab Cgbilliar Excel Worksheet Functions 1 November 7th 04 05:57 PM


All times are GMT +1. The time now is 03:00 AM.

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

About Us

"It's about Microsoft Excel"