Results 1 to 42 of 42

VBA Conditional Formatting - Change Font Color across row per 1st column (6 colors)

Threaded View

jds217 VBA Conditional Formatting -... 04-09-2009, 01:06 PM
Kenneth Hobson Re: VBA Conditional... 04-09-2009, 01:57 PM
royUK Re: VBA Conditional... 04-09-2009, 02:14 PM
foxguy Re: VBA Conditional... 04-09-2009, 02:20 PM
royUK Re: VBA Conditional... 04-09-2009, 02:41 PM
jds217 Re: VBA Conditional... 04-09-2009, 03:02 PM
jds217 Re: VBA Conditional... 04-09-2009, 03:07 PM
royUK Re: VBA Conditional... 04-09-2009, 03:23 PM
foxguy Re: VBA Conditional... 04-09-2009, 03:38 PM
jds217 Re: VBA Conditional... 04-09-2009, 03:46 PM
jds217 Re: VBA Conditional... 04-09-2009, 03:56 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:07 PM
jds217 Re: VBA Conditional... 04-09-2009, 04:07 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:10 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:13 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:14 PM
jds217 Re: VBA Conditional... 04-09-2009, 04:18 PM
jds217 Re: VBA Conditional... 04-09-2009, 04:18 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:23 PM
jds217 Re: VBA Conditional... 04-09-2009, 04:25 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:30 PM
jds217 Re: VBA Conditional... 04-09-2009, 04:45 PM
foxguy Re: VBA Conditional... 04-09-2009, 04:50 PM
jds217 Re: VBA Conditional... 04-09-2009, 04:52 PM
shg Re: VBA Conditional... 04-09-2009, 05:00 PM
foxguy Re: VBA Conditional... 04-09-2009, 05:03 PM
foxguy Re: VBA Conditional... 04-09-2009, 05:08 PM
jds217 Re: VBA Conditional... 04-09-2009, 05:23 PM
foxguy Re: VBA Conditional... 04-09-2009, 05:52 PM
foxguy Re: VBA Conditional... 04-09-2009, 05:30 PM
foxguy Re: VBA Conditional... 04-09-2009, 05:37 PM
jds217 Re: VBA Conditional... 04-09-2009, 05:43 PM
jds217 Re: VBA Conditional... 04-09-2009, 06:09 PM
foxguy Re: VBA Conditional... 04-09-2009, 06:16 PM
foxguy Re: VBA Conditional... 04-09-2009, 06:10 PM
jds217 Re: VBA Conditional... 04-09-2009, 06:22 PM
jds217 Re: VBA Conditional... 04-09-2009, 06:54 PM
jds217 Re: VBA Conditional... 04-09-2009, 09:08 PM
jds217 Re: VBA Conditional... 04-09-2009, 09:19 PM
foxguy Re: VBA Conditional... 04-10-2009, 12:07 AM
royUK Re: VBA Conditional... 04-10-2009, 03:55 AM
jds217 Re: VBA Conditional... 04-10-2009, 08:50 AM
  1. #39
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Conditional Formatting - Change Font Color across row per 1st column (6 color

    The amended code that I posted is triggered when the initial is selected in the Data validation list. It colours each cell in the row of that day.I used xlToRight because your blocks did not all contain the same number of columns. If you have a fixed number of columns in each day then the code could be amended easily. The only necessity is an empty column between days and it will work without changing on each day that you add.

    Code to colour the initials plus next four columns
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Count > 1 Then Exit Sub
        Dim lColour As Long
        Dim Rw As Long
        Dim Col As Long
        If Not Intersect(Target, _
                         ActiveSheet.UsedRange.SpecialCells(xlCellTypeAllValidation)) Is Nothing Then
                         Rw = Target.Row
                         Col = Target.Column
            Select Case Target.Value
                Case Cells(4, 28).Value: lColour = 1
                Case Cells(5, 28).Value: lColour = 3
                Case Cells(6, 28).Value: lColour = 4
                Case Cells(7, 28).Value: lColour = 7
                Case Cells(8, 28).Value: lColour = 5
                Case Cells(9, 28).Value: lColour = 46
                Case Else: Exit Sub
            End Select
            'colour 5 cells including Target with initials in
            Range(Cells(Rw, Col), Cells(Rw, Col + 4)).Font.ColorIndex = lColour
        End If
    End Sub
    What is it not doing that you outlined in the first post? You don't need loops hich will only slow down the code.
    Attached Files Attached Files
    Last edited by royUK; 04-10-2009 at 04:12 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1