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: 367
Default Sharing a workbook breaks VBA code?

The following code acts as conditional formatting (as conditional formatting
only allows for 3 conditions) for a worksheet shared by multiple people. When
I added the code and tested it, everything seemed to work fine. That was
until another individual let me know that it did not work for them. Upon
further investigation, it seems that I am the only one that he code works
for. Does sharing the workbook in essence break/ignore the code? Is there a
workaround for this type of problem. Many thanks in advance.

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Intersect(Target, Range("A3:A50"))
If Not t Is Nothing Then
Upper t
FillCells t
End If
End Sub

Public Sub Upper(ByVal Target As Range)
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End Sub

Public Sub FillCells(ByVal Target As Range)
Select Case Target
Case "X"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 15
.Font.ColorIndex = xlColorIndexAutomatic
End With
Next c
Case "P"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 6
.Font.ColorIndex = xlColorIndexAutomatic
End With
Next c
Case "L"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 45
.Font.ColorIndex = xlColorIndexAutomatic
End With
Next c
Case "D"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 50
.Font.ColorIndex = xlColorIndexAutomatic
End With
Next c
Case "QA"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 38
.Font.ColorIndex = xlColorIndexAutomatic
End With
Next c
Case "QC"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 55
.Font.ColorIndex = 2
End With
Next c
Case "S"
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = 53
.Font.ColorIndex = 2
End With
Next c
Case Else
For c = 1 To 12
With Target(1, c)
.Interior.ColorIndex = xlColorIndexNone
.Font.ColorIndex = xlColorIndexAutomatic
End With
Next c
End Select
End Sub
 
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
Sharing a workbook Kerry Excel Discussion (Misc queries) 4 May 13th 09 06:10 PM
Workbook Sharing Sheryl[_2_] Excel Discussion (Misc queries) 3 August 24th 07 11:05 PM
After sharing workbook VB code stops working. Runtime Error 1004 Patrick LaFerriere Excel Programming 0 October 5th 05 04:01 PM
Locked workstation breaks code? Scott Stonehouse Excel Programming 0 June 8th 04 06:22 PM


All times are GMT +1. The time now is 12:17 PM.

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"