ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Box around selected range (https://www.excelbanter.com/excel-programming/276278-re-box-around-selected-range.html)

Tom Ogilvy

Box around selected range
 
I suspect you are setting the userinterfaceonly property of the sheets in
the workbook_open event. I have found if you set protection on a sheet in
workbook_open when the sheet is not active, you get this type of behavior

Try

set sh1 = activeSheet
Application.ScreenUpdating = False
for each sh in thisWorkbook.Worksheets
sh.Activate
sh.Protect UserInterfaceOnly:=True ' other options
Next
sh1.activate
Application.ScreenUpdating = True

--
Regards,
Tom Ogilvy

Terry von Gease wrote in message
...
What could happen to cause the frame around the currently selected range

on
a sheet to not appear? The sheet behaves normally if you mouse, tab, or
what-have-you to an unlocked cell or range in that the cell address in the
formula bar is correct for where you are but no frame appears

This seems to affect any or all sheets in a workbook form time to time.
Mostly more than less. All of the sheets feature small ranges of unlocked
cells and are all in protected mode with only the ability to select

unlocked
cells. The sheets are protected with UserInterfaceOnly:=True

If you manually unprotect any of the sheets and then manually protect them
again the problem goes away. The box around the selection functions

exactly
as it should. If you free up the selection highlight on all the sheets and
save the workbook the next time you open it the selection highlight once
more isn't working properly.

I'm sure I'm setting up something wrong somewhere, there's lots of code
invoked at WorkBook_Open time that diddles the various sheets but it's
unclear just what is causing this.

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley





Terry von Gease

Box around selected range
 
You're exactly right. In fact, with other than trivial variation in naming,
the loop you presented is identical with the loop I was using except for the
Activate.

Thanks, I do appreciate it.

Are there many of these little anomalies that can leap out of the canebrake
and bite you on the ass?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley

"Tom Ogilvy" wrote in message
...
I suspect you are setting the userinterfaceonly property of the sheets in
the workbook_open event. I have found if you set protection on a sheet in
workbook_open when the sheet is not active, you get this type of behavior

Try

set sh1 = activeSheet
Application.ScreenUpdating = False
for each sh in thisWorkbook.Worksheets
sh.Activate
sh.Protect UserInterfaceOnly:=True ' other options
Next
sh1.activate
Application.ScreenUpdating = True

--
Regards,
Tom Ogilvy

Terry von Gease wrote in message
...
What could happen to cause the frame around the currently selected range

on
a sheet to not appear? The sheet behaves normally if you mouse, tab, or
what-have-you to an unlocked cell or range in that the cell address in

the
formula bar is correct for where you are but no frame appears

This seems to affect any or all sheets in a workbook form time to time.
Mostly more than less. All of the sheets feature small ranges of

unlocked
cells and are all in protected mode with only the ability to select

unlocked
cells. The sheets are protected with UserInterfaceOnly:=True

If you manually unprotect any of the sheets and then manually protect

them
again the problem goes away. The box around the selection functions

exactly
as it should. If you free up the selection highlight on all the sheets

and
save the workbook the next time you open it the selection highlight once
more isn't working properly.

I'm sure I'm setting up something wrong somewhere, there's lots of code
invoked at WorkBook_Open time that diddles the various sheets but it's
unclear just what is causing this.

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley








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

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