VBA Code not working on Shared Workbook

K

KC_Cheer_Coach

I have the following code in a workbook. It works fine when the worksheets
inside the workbook are protected but not when the workbook is shared. Is
there any way to make this work on the shared workbook?

Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

Dim iRange As Range
Dim Cross1 As Range
Dim Cross2 As Range

Set Cross1 = Intersect(Target, Range(Cells(2, 6), Cells(30, 6)))
Set Cross2 = Intersect(Target, Range(Cells(2, 6), Cells(30, 6)))

If Not Cross1 Is Nothing Or Not Cross2 Is Nothing Then
For Each Target In Sh.Range(Cells(2, 6), Cells(30, 6))
If ((Cross1.Value = "D") And (Cross2.Value2 <> "C")) Then
Sh.Tab.ColorIndex = 3
ElseIf Cross2.Value2 = "C" Then
Sh.Tab.ColorIndex = 5
Else
Sh.Tab.ColorIndex = xlColorIndexNone

End If
Next
End If
 
D

Dave Peterson

There are lots of features that are disabled in shared workbooks.

When I share a workbook and then try to change the sheet tab color, I see that
it's disabled.

Maybe you can use a different indicator--something (prefix/suffix) in the sheet
name???
 
K

KC_Cheer_Coach

Well, I guess if it can't be done I will settle for that. But...

Is there a way to somehow say:

If ((Cross1.Value = "D") And (Cross2.Value2 <> "C")) Then

REMOVE SHARE

CHANGE THE COLOR OF THE TAB

SHARE WORKBOOK

ElseIf Cross2.Value2 = "C" Then

REMOVE SHARE

CHANGE THE COLOR OF THE TAB

SHARE WORKBOOK

Else DO NOTHING

Can this be done??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel 5
Complex date VBA - insert a certain weekday 8
Event recognition. 11
Macro Help 3
Ambiguous name detected: worksheet_change 2
Macro Excell 03/07 2
Macro error 1
Working outlook via vba code with xlsx - error 0

Top