Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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
Posted to microsoft.public.excel.newusers
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to display current page # in any cel , not header & footer | Excel Discussion (Misc queries) | |||
How to get current worksheet name to display in a cell? | Excel Worksheet Functions | |||
How can I Run a query from VB macro with out affect current data in the same sheet? | Excel Discussion (Misc queries) | |||
UDF is updateing cells on another sheet with count from current sheet. | Excel Discussion (Misc queries) | |||
Can I display the current date in a text box? | Excel Discussion (Misc queries) |