Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default worksheet_change not working


Can anyone tell me why the following Worksheet_change event isn
working?
It should be doing the following:
Look at cell B4, if it says "Specialty" then it runs macro TLdev1,
if it says "SubSpecialty" then it runs TLdev2,
else if it says "consultant" then it should run TLdev3.

The actual macros themselves takes the column range: B:P and format
the cells dependent upon the value.

At the moment, these macro are in sheet1.

Many thank for your help with this.

Scott.



Macros starts he

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$4" Then
If Target.Value = "Specialty" Then
Call TLdev1
ElseIf Target.Value = "SubSpecialty" Then
Call TLdev2
Else: Target.Value = "Consultant"
Call TLdev3
End If
End If
End Sub

Sub TLdev1() 'Spec level
Dim Cell As Range
Cells.Interior.ColorIndex = xlNone
For Each Cell In Intersect(Columns("B:P"), _
Cells.SpecialCells(xlConstants, xlNumbers))
Cell.Value = Cell.Value
Select Case Cell.Value
Case Is = 250
Cell.Interior.ColorIndex = 3 'red
Case Is = 100
Cell.Interior.ColorIndex = 6 'Yellow
Case Is = 50
Cell.Interior.ColorIndex = 4 'Green
Case Else
Cell.Interior.ColorIndex = xlNone
End Select
Next Cell
End Sub

Sub TLdev2() 'Subspec level
Dim Cell As Range
Cells.Interior.ColorIndex = xlNone
For Each Cell In Intersect(Columns("B:P"), _
Cells.SpecialCells(xlConstants, xlNumbers))
Cell.Value = Cell.Value
Select Case Cell.Value
Case Is = 100
Cell.Interior.ColorIndex = 3 'red
Case Is = 50
Cell.Interior.ColorIndex = 6 'Yellow
Case Is = 25
Cell.Interior.ColorIndex = 4 'Green
Case Else
Cell.Interior.ColorIndex = xlNone
End Select
Next Cell
End Sub

Sub TLdev3() 'Consultant level
Dim Cell As Range
Cells.Interior.ColorIndex = xlNone
For Each Cell In Intersect(Columns("B:P"), _
Cells.SpecialCells(xlConstants, xlNumbers))
Cell.Value = Cell.Value
Select Case Cell.Value
Case Is = 30
Cell.Interior.ColorIndex = 3 'red
Case Is = 15
Cell.Interior.ColorIndex = 6 'Yellow
Case Is = 7
Cell.Interior.ColorIndex = 4 'Green
Case Else
Cell.Interior.ColorIndex = xlNone
End Select
Next Cell
End Su

--
scottwilson
-----------------------------------------------------------------------
scottwilsonx's Profile: http://www.excelforum.com/member.php...fo&userid=1112
View this thread: http://www.excelforum.com/showthread.php?threadid=27159

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
Worksheet_Change method not working in Excel 97 Manoj Kumar Sharma Excel Programming 4 October 6th 04 10:38 AM
Worksheet_Change not working when using paste papou[_7_] Excel Programming 1 September 5th 03 12:57 PM
Worksheet_Change Event Not Working Michael Beckinsale Excel Programming 0 August 1st 03 02:43 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


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