View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phyllis Phyllis is offline
external usenet poster
 
Posts: 34
Default Changing tab color locks the worksheet

Below is the code where I am successfully changing the worksheet tab color
under a certain conditon. However, after the tab is changed, I cannot
navigate away from that spreadsheet to another one. It is as if it is
locked. I watched the code as it ran and it ran thru "end sub". I am using
VBA 6.5 and excel 2003. Any ideas?

Private Sub Worksheet_Deactivate()
Debug.Print "order deactivate"
Dim orderWS As Worksheet
Dim tabRg As Range
Set orderWS = ThisWorkbook.Worksheets(activesheet)
Set tabRg = orderWS.Range("F40")

' check if carrier has been assigned and then change color tab if it has

Debug.Print tabRg.Value
'If tabRg.Value " " Then
'Sheets(activesheet).Select
' ActiveWorkbook.Sheets(activesheet).Tab.ColorIndex = 35
'End If


ErrorProcess:
If Err.Number < 0 Then
MsgBox Err.Description & " In worksheet-deactivate", vbCritical, "Error
# " & Err.Number
End If


End Sub