LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default weird focus problem

Hi Taher

I always use a select line with this kind off code
See this example for all sheets in the workbook

Private Sub Workbook_Open()
Dim Sh As Worksheet
Application.ScreenUpdating = False
For Each Sh In ThisWorkbook.Worksheets
Sh.Select
Sh.Protect userinterfaceonly:=True
Sh.EnableSelection = xlUnlockedCells
Next
Sheets(1).Select
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Taher Baderkhan" wrote in message ...
Hi,

I am using a worksheet which I called "Input" as a
form. I am allowing the user to input data only in the
cells that are unlocked. I am protecting the worksheet on
initialization of the workbook using the following VBA
code:

Set ws = ActiveWorkbook.Worksheets("Input")
ws.EnableSelection = xlUnlockedCells
ws.Protect UserInterfaceOnly:=True

if the user opens up the workbook and the "Input"
worksheet is the active sheet then everything works as
expected. However, if the active sheet is not the "Input"
worksheet and then through the code I attempt to activate
the "Input" sheet and select any cell then the focus
border seems to either disappear or freeze. It does not
matter whether the cell I am attempting to select is
locked or not. If I run the code that set the protection
for the "Input" sheet again the focus problems gets
fixed. If I activate another sheet and then reactivate
the "Input" sheet through the code (basically, trying to
regenerate the problem) the focus seems to work just fine.
I have realized that this problem exists only when you try
it the first time. To regenerate the problem I had to shut
down excel and reopen the workbook.

I tried to play with the UseInterfaceOnly by trying
different combinations but the problem seemed to persist.

The workaround I found Thus far is to run
ws.EnableSelection = xlNoRestrictions, Activate
the "Input" sheet and then run
ws.EnableSelection = xlUnlockedCells. Is there any better
solution?

Taher



 
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
weird problem WarrenK Setting up and Configuration of Excel 0 June 5th 09 05:46 PM
Weird Problem Gaurav[_2_] Excel Worksheet Functions 4 December 17th 07 04:27 PM
cmdbarmenu focus problem pjbur2005 via OfficeKB.com Excel Worksheet Functions 2 January 28th 07 02:44 AM
Weird problem Sue Excel Worksheet Functions 2 November 29th 05 12:10 PM
Weird Problem Patrick Excel Worksheet Functions 4 March 28th 05 02:29 AM


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

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"