ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unlocking in 97 (https://www.excelbanter.com/excel-programming/279888-unlocking-97-a.html)

Wes[_5_]

Unlocking in 97
 
I've written some code that makes changes to a protected
sheet. Therefore it had to be unprotected. I know that
in 97 the problem is that it is confused about what has
the focus so you need to activate the sheet and possibly
the active cell. The problem this time is that at that
point of the program 2 sheets are seleted. The only
soloution I came up with that seems to work is to have the
program select a different sheet then select the sheet I
want to unlock, unlock it make the changes, lock it,
select the 2 sheets again. This is not a great soloution
since the program repeats this a number of times, printing
the 2 sheets, making some changes then printing again.

Is there a way around this, like an unselect command for
one of the sheets or a way that I could unprotect a page
even when 2 sheets are selected.

Thanks in advance for any help.

Wes

Don Guillett[_4_]

Unlocking in 97
 
Best to post your coding efforts

"Wes" wrote in message
...
I've written some code that makes changes to a protected
sheet. Therefore it had to be unprotected. I know that
in 97 the problem is that it is confused about what has
the focus so you need to activate the sheet and possibly
the active cell. The problem this time is that at that
point of the program 2 sheets are seleted. The only
soloution I came up with that seems to work is to have the
program select a different sheet then select the sheet I
want to unlock, unlock it make the changes, lock it,
select the 2 sheets again. This is not a great soloution
since the program repeats this a number of times, printing
the 2 sheets, making some changes then printing again.

Is there a way around this, like an unselect command for
one of the sheets or a way that I could unprotect a page
even when 2 sheets are selected.

Thanks in advance for any help.

Wes




steve

Unlocking in 97
 
Wes,

If your code is sheet specific, it shouldn't matter if multiple sheets are
selected.

This worked for me when sheets 1 & 2 were selected and only sheet 1
had the result.

Sheets("Sheet1").Range("A1") = "steve"

You should be able to unprotect and protect the same way.

--
sb
"Wes" wrote in message
...
I've written some code that makes changes to a protected
sheet. Therefore it had to be unprotected. I know that
in 97 the problem is that it is confused about what has
the focus so you need to activate the sheet and possibly
the active cell. The problem this time is that at that
point of the program 2 sheets are seleted. The only
soloution I came up with that seems to work is to have the
program select a different sheet then select the sheet I
want to unlock, unlock it make the changes, lock it,
select the 2 sheets again. This is not a great soloution
since the program repeats this a number of times, printing
the 2 sheets, making some changes then printing again.

Is there a way around this, like an unselect command for
one of the sheets or a way that I could unprotect a page
even when 2 sheets are selected.

Thanks in advance for any help.

Wes




Wes[_5_]

A sample Code
 
Here is the code: (I don't have xp on this computer, but
I'm sure it does work on xp. The problem is when I run
this on 97)


Sub unlockit()
With Worksheets("sheet1")

.Unprotect
.Range("a1").Value = "unlocked"
.Protect
End With
End Sub

This works fine if you have a single sheet selected. It
does not work if you have both sheets 1 and 2 selected.

Is there an "ungroup" command?

-----Original Message-----
I've written some code that makes changes to a protected
sheet. Therefore it had to be unprotected. I know that
in 97 the problem is that it is confused about what has
the focus so you need to activate the sheet and possibly
the active cell. The problem this time is that at that
point of the program 2 sheets are seleted. The only
soloution I came up with that seems to work is to have

the
program select a different sheet then select the sheet I
want to unlock, unlock it make the changes, lock it,
select the 2 sheets again. This is not a great soloution
since the program repeats this a number of times,

printing
the 2 sheets, making some changes then printing again.

Is there a way around this, like an unselect command for
one of the sheets or a way that I could unprotect a page
even when 2 sheets are selected.

Thanks in advance for any help.

Wes
.


Don Guillett[_4_]

A sample Code
 
try just adding as the first line to ungroup
sheets("sheet1").select

"Wes" wrote in message
...
Here is the code: (I don't have xp on this computer, but
I'm sure it does work on xp. The problem is when I run
this on 97)


Sub unlockit()
With Worksheets("sheet1")

.Unprotect
.Range("a1").Value = "unlocked"
.Protect
End With
End Sub

This works fine if you have a single sheet selected. It
does not work if you have both sheets 1 and 2 selected.

Is there an "ungroup" command?

-----Original Message-----
I've written some code that makes changes to a protected
sheet. Therefore it had to be unprotected. I know that
in 97 the problem is that it is confused about what has
the focus so you need to activate the sheet and possibly
the active cell. The problem this time is that at that
point of the program 2 sheets are seleted. The only
soloution I came up with that seems to work is to have

the
program select a different sheet then select the sheet I
want to unlock, unlock it make the changes, lock it,
select the 2 sheets again. This is not a great soloution
since the program repeats this a number of times,

printing
the 2 sheets, making some changes then printing again.

Is there a way around this, like an unselect command for
one of the sheets or a way that I could unprotect a page
even when 2 sheets are selected.

Thanks in advance for any help.

Wes
.





All times are GMT +1. The time now is 01:23 AM.

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