Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
ann ann is offline
external usenet poster
 
Posts: 210
Default Display current sheet name being processed in macro

I have the following macro that will protect each sheet in a workbook.

For n = 1 To Sheets.Count
'Sheets(n).Protect Password:="&PasswordEntered"
Title = "Protecting sheet"
Style = vbInformation
MsgBox "Sheet Protected ", Style, Title
Next n

I need to display the sheet name back to the user, can someone suggest how I
do that within the macro along with the msgbox?

--
Thank U and Regards

Ann

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,101
Default Display current sheet name being processed in macro

Try your macro altered like this:-

Sub protect()
For n = 1 To Sheets.Count
Sheets(n).protect 'Password:="&PasswordEntered"

Title = "Protecting sheet"
Style = vbInformation
Message = ActiveSheet.Name & " Protected"
MsgBox Message, Style, Title
Next n
End Sub

Mike

"Ann" wrote:

I have the following macro that will protect each sheet in a workbook.

For n = 1 To Sheets.Count
'Sheets(n).Protect Password:="&PasswordEntered"
Title = "Protecting sheet"
Style = vbInformation
MsgBox "Sheet Protected ", Style, Title
Next n

I need to display the sheet name back to the user, can someone suggest how I
do that within the macro along with the msgbox?

--
Thank U and Regards

Ann

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,101
Default Display current sheet name being processed in macro

OOPS missed a line

Sub protect()
For n = 1 To Sheets.Count

Sheets(n).protect 'Password:="&PasswordEntered"
Sheets(n).Select
Title = "Protecting sheet"
Style = vbInformation
Message = ActiveSheet.Name & " Protected"
MsgBox Message, Style, Title
Next n
End Sub

"Ann" wrote:

I have the following macro that will protect each sheet in a workbook.

For n = 1 To Sheets.Count
'Sheets(n).Protect Password:="&PasswordEntered"
Title = "Protecting sheet"
Style = vbInformation
MsgBox "Sheet Protected ", Style, Title
Next n

I need to display the sheet name back to the user, can someone suggest how I
do that within the macro along with the msgbox?

--
Thank U and Regards

Ann

  #4   Report Post  
Posted to microsoft.public.excel.newusers
ann ann is offline
external usenet poster
 
Posts: 210
Default Display current sheet name being processed in macro

Mike,

I copied your code and it displays the Active Sheet Name (say sheet1) every
time.

I want the macro to display the sheet name as it goes through the workbook.

Any ideas?
--
Thank U and Regards

Ann



"Mike" wrote:

Try your macro altered like this:-

Sub protect()
For n = 1 To Sheets.Count
Sheets(n).protect 'Password:="&PasswordEntered"

Title = "Protecting sheet"
Style = vbInformation
Message = ActiveSheet.Name & " Protected"
MsgBox Message, Style, Title
Next n
End Sub

Mike

"Ann" wrote:

I have the following macro that will protect each sheet in a workbook.

For n = 1 To Sheets.Count
'Sheets(n).Protect Password:="&PasswordEntered"
Title = "Protecting sheet"
Style = vbInformation
MsgBox "Sheet Protected ", Style, Title
Next n

I need to display the sheet name back to the user, can someone suggest how I
do that within the macro along with the msgbox?

--
Thank U and Regards

Ann

  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4,624
Default Display current sheet name being processed in macro

One way:

Dim n As Long
For n = 1 To Sheets.Count
With Sheets(n)
.Protect Password:="&PasswordEntered"
MsgBox Prompt:= .Name & " Protected", _
Title:="Protecting Sheet", _
Buttons:=vbInformation
End WIth
Next n

In article ,
Ann wrote:

I have the following macro that will protect each sheet in a workbook.

For n = 1 To Sheets.Count
'Sheets(n).Protect Password:="&PasswordEntered"
Title = "Protecting sheet"
Style = vbInformation
MsgBox "Sheet Protected ", Style, Title
Next n

I need to display the sheet name back to the user, can someone suggest how I
do that within the macro along with the msgbox?



  #6   Report Post  
Posted to microsoft.public.excel.newusers
ann ann is offline
external usenet poster
 
Posts: 210
Default Display current sheet name being processed in macro

Mike, JE,

Thank U for your kind assistance.
--
Thank U and Regards

Ann



"JE McGimpsey" wrote:

One way:

Dim n As Long
For n = 1 To Sheets.Count
With Sheets(n)
.Protect Password:="&PasswordEntered"
MsgBox Prompt:= .Name & " Protected", _
Title:="Protecting Sheet", _
Buttons:=vbInformation
End WIth
Next n

In article ,
Ann wrote:

I have the following macro that will protect each sheet in a workbook.

For n = 1 To Sheets.Count
'Sheets(n).Protect Password:="&PasswordEntered"
Title = "Protecting sheet"
Style = vbInformation
MsgBox "Sheet Protected ", Style, Title
Next n

I need to display the sheet name back to the user, can someone suggest how I
do that within the macro along with the msgbox?


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
How to display current page # in any cel , not header & footer Tpeila Excel Discussion (Misc queries) 0 February 7th 07 09:15 PM
How to get current worksheet name to display in a cell? xfixiate Excel Worksheet Functions 2 July 22nd 06 09:24 AM
How can I Run a query from VB macro with out affect current data in the same sheet? oafdl Excel Discussion (Misc queries) 0 May 29th 06 09:42 PM
UDF is updateing cells on another sheet with count from current sheet. John Excel Discussion (Misc queries) 3 March 20th 06 03:58 PM
Can I display the current date in a text box? stephiebrady Excel Discussion (Misc queries) 2 December 2nd 05 02:45 PM


All times are GMT +1. The time now is 06:39 PM.

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"