ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   is this possible, replacing password protected sheet text with mac (https://www.excelbanter.com/excel-programming/380018-possible-replacing-password-protected-sheet-text-mac.html)

Rajat

is this possible, replacing password protected sheet text with mac
 
I am using Excel 2003 and have a file where there are 175 sheets, each sheet
is used to collect data for different project - but the same format is used
in each sheet to collect data, only difference between those sheet is 'Name
of Sheet' which is 1, 2, 3, 4 upto 175.

All those sheets are password protected using DataToolsprotect sheet option
and my pass word is "project"

my problem is that by mistake i have written in cell $I$43 "Start Date" -
instead of this there should be "Amount" so i have to change this in all 175
sheet. For this i have to unprotect the sheet first and then type the text
and protect the sheet again. which is a time consuming process.

Can any one help me with a macro which can do this task ( in all 175 sheet
in cell $I$43 in place of text "Start Date" replace by "Amount" and keep the
sheet password protected) .

Thanx in advance

Rajat


Mike Fogleman

is this possible, replacing password protected sheet text with mac
 
Sub unpro()
Dim w As Worksheet
For Each w In Worksheets
w.Unprotect ("project")
Range("$I$43").Value = "Amount"
w.protect Password:="project"
Next
End Sub

Mike F

"Rajat" wrote in message
...
I am using Excel 2003 and have a file where there are 175 sheets, each
sheet
is used to collect data for different project - but the same format is
used
in each sheet to collect data, only difference between those sheet is
'Name
of Sheet' which is 1, 2, 3, 4 upto 175.

All those sheets are password protected using DataToolsprotect sheet
option
and my pass word is "project"

my problem is that by mistake i have written in cell $I$43 "Start Date" -
instead of this there should be "Amount" so i have to change this in all
175
sheet. For this i have to unprotect the sheet first and then type the text
and protect the sheet again. which is a time consuming process.

Can any one help me with a macro which can do this task ( in all 175 sheet
in cell $I$43 in place of text "Start Date" replace by "Amount" and keep
the
sheet password protected) .

Thanx in advance

Rajat




Rajat

is this possible, replacing password protected sheet text with
 
Dear Mike Fogleman

thanks for the quick reply, the code did not work properly
i have pasted the code in the module of VBA using Insert Module but the
problem is when i run the macro it give this error -

Run-time error '1004'
Application-defined or object-defined error
and provide 3 option "End" "Debug" "Help"

but i noticed that the cell value on the active sheet is changed to "Amount".
have i done any mistake in pasting the code in VBA?

I hope you can rectify the proble with this explanation.



Dave Peterson

is this possible, replacing password protected sheet text with
 
Try this modified version of Mike's code:

Option Explicit

Sub unpro()
Dim w As Worksheet
For Each w In Worksheets
w.Unprotect "project"
w.Range("I43").Value = "Amount"
w.Protect Password:="project"
Next
End Sub

Notice that there's a "w." in front of range("I43"). Without that "w.", then
range("I43") refers to the currently activesheet.

Rajat wrote:

Dear Mike Fogleman

thanks for the quick reply, the code did not work properly
i have pasted the code in the module of VBA using Insert Module but the
problem is when i run the macro it give this error -

Run-time error '1004'
Application-defined or object-defined error
and provide 3 option "End" "Debug" "Help"

but i noticed that the cell value on the active sheet is changed to "Amount".
have i done any mistake in pasting the code in VBA?

I hope you can rectify the proble with this explanation.


--

Dave Peterson

Rajat

is this possible, replacing password protected sheet text with
 
thanks Dave :)


Mike Fogleman

is this possible, replacing password protected sheet text with
 
Yeah, thanks Dave. I wasn't completely awake yet.
"Rajat" wrote in message
...
thanks Dave :)





All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com