Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default VBA Code not working on Shared Workbook

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

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default VBA Code not working on Shared Workbook

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???

KC_Cheer_Coach wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default VBA Code not working on Shared Workbook

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??


"Dave Peterson" wrote:

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???

KC_Cheer_Coach wrote:

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


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default VBA Code not working on Shared Workbook

Try recording a macro when you do it manually and you'll have the code.

KC_Cheer_Coach wrote:

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??

"Dave Peterson" wrote:

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???

KC_Cheer_Coach wrote:

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


--

Dave Peterson


--

Dave Peterson
Reply
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
Shared Workbook not working jazztpt Excel Discussion (Misc queries) 0 May 27th 07 12:24 PM
Printing viewing a shared workbook on a shared drive aloomba Excel Discussion (Misc queries) 0 April 13th 07 02:52 PM
update pivot in shared shared workbook 00George00 Excel Discussion (Misc queries) 1 August 23rd 06 08:16 PM
activesheet.tab.colorindex not working when workbook shared Martin Appleton Excel Discussion (Misc queries) 0 July 21st 06 08:45 AM
Often-Used Code not working in a new Workbook Steve Excel Discussion (Misc queries) 2 December 16th 04 11:55 PM


All times are GMT +1. The time now is 03:43 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"