LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 22,906
Default Color in Form Fields

I tested with this code..................

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
ActiveSheet.Unprotect Password:="justme"
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If
Set OldCell = Target
OldCell.Interior.ColorIndex = 6
OldCell.Borders.LineStyle = xlContinuous
Else
If OldCell Is Nothing Then
Set OldCell = Target
Else
Set OldCell = Union(OldCell, Target)
End If
End If
ActiveSheet.Protect Password:="justme"
End Sub

My testing with random cells in columns A, D, and G given a thick border,
protection set to "unlocked" and sheet protected with the password
"justme"(quotes required). You can safely change that password with no
effect on the code.

Hit Tab and next unlocked cell is selected, color to yellow and border
preserved.

Tab to next unlocked cell and color is yellow and border preserved.

Previous cell loses color and border has been preserved.

Do you want the tabbed to cells to reatin the color yellow?

I would not think so given your requirement to highlight current cell for
user.

Somehow you may have disabled events while booping about.

Sub enable_events()
Application.EnableEvents = True
End Sub


Gord

On Tue, 2 Sep 2008 10:31:02 -0700, JWeaver
wrote:

I removed that line and now the colors aren't working. Does something else
need to be changed as well?

Also, I removed the code completely and then repasted it and it still didn't
work. I changed the password in your code to the one I had set for me file
and it still didn't fix it (I had already changed the password to match mine
in the one that worked to change the colors but forgot to mention it in my
earlier post).

Thanks!


 
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
Having required fields in fill-in form shepherdess Excel Discussion (Misc queries) 3 April 18th 08 09:13 PM
Form Fields Anna Excel Discussion (Misc queries) 1 November 21st 06 12:42 AM
Form Fields or Controls? David Cahill Excel Discussion (Misc queries) 1 May 14th 06 03:07 AM
Tabbing through form fields soma104 Excel Discussion (Misc queries) 0 May 11th 06 02:44 PM
Form Fields mcaalcorn Excel Discussion (Misc queries) 0 March 3rd 06 11:06 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"