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: 325
Default Worksheet change code to colour in rows in a database

Good afternoon, all,

One column in my database ("ColStatus") is validated by a drop down list,
and depending on the value selected, I want the interior colour for all
database cells in the target row to change. In the code shown below, the
msgboxes work fine, so the case logic is OK, but in each case, the colour
doesn't change.
Can any clever person out there suggest why this might be?
The worksheet isn't protected.
Thanks in anticipation

Pete



Private Sub Worksheet_Change(ByVal Target As Range)

Dim DBSheet As Worksheet
Dim ColStatus As Range

Set DBSheet = Sheets("Database")
Set ColStatus = DBSheet.Range("ColStatus")

Set Intersection = Intersect(Target, ColStatus)
If Not Intersection Is Nothing Then
Select Case Target.Formula
Case "Withdrawn"
MsgBox ("Withdrawn")
Target.Offset(0, -12).Resize(1, 30).Interior.ColorIndex = 3
Target.Offset(0, -12).Resize(1, 30).Font.ColorIndex =
xlAutomatic
Case "Completed"
MsgBox ("Completed")
Target.Offset(0, -12).Resize(1, 30).Interior.ColorIndex = 4
Target.Offset(0, -12).Resize(1, 30).Font.ColorIndex =
xlAutomatic
Case "On Hold"
MsgBox ("On Hold")
Target.Offset(0, -12).Resize(1, 30).Interior.ColorIndex = 45
Target.Offset(0, -12).Resize(1, 30).Font.ColorIndex =
xlAutomatic
Case Else
MsgBox ("Other")
Target.Offset(0, -12).Resize(1, 30).Interior.ColorIndex = 38
Target.Offset(0, -12).Resize(1, 30).Font.ColorIndex =
xlAutomatic
End Select
End If
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
How can I change worksheet background colour Mark Setting up and Configuration of Excel 2 January 5th 21 07:17 AM
Change colour of rows in a worksheet VJ Sharma[_2_] Excel Discussion (Misc queries) 1 May 13th 09 11:14 AM
Formula to change rows a different colour? John Excel Worksheet Functions 2 August 10th 05 11:56 PM
Change even rows to a predefined colour Pat Excel Programming 4 March 16th 05 01:16 AM
Code to change interior colour only if current interior colour is BeSmart Excel Programming 2 October 5th 04 12:06 AM


All times are GMT +1. The time now is 09:06 AM.

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"