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: 95
Default Formatting cells - December issue!

Hi there,

I have an issue (or possibly have issues), I have set up this code which
will go through my data and see if there is an action to be looked at or that
was meant to be looked at and hasn't and highlight the cell in a colour. It
works how i want it on the most part - but for some reason every date that is
Dec-07 seems to highlight as well regardless of the other data around it.
Would anyone know why this is? (Code is below)

Sub changeColour()
Dim myR1 As Range
Dim wbBook As Workbook
Dim wsMain As Worksheet
Dim myCell1 As Range
Dim aValue As String

Set wbBook = ThisWorkbook
Set wsMain = wbBook.Worksheets("Sheet1")
Set myR1 = wsMain.Range("J2:J168")

For Each myCell1 In myR1

If myCell1.Offset(0, -2).Value < "" And _
Month(myCell1.Offset(0, -9).Value) < Month(myCell1.Offset(0, -2).Value)
Or _
Month(myCell1.Offset(0, -9).Value) = Month(myCell1.Offset(0, -2).Value) _
Then
myCell1.Select
myCell1.Interior.ColorIndex = 37
Else
myCell1.Interior.ColorIndex = 0
End If

Next myCell1

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
Formatting issue Iriemon Excel Worksheet Functions 2 February 24th 10 03:23 PM
Return Month in word form. 12=December Dustin B New Users to Excel 4 January 21st 08 08:33 PM
Formula copy for December Learning Excel Excel Discussion (Misc queries) 5 December 2nd 07 06:34 PM
Formatting issue ??? yarrakid Excel Discussion (Misc queries) 0 June 13th 06 09:31 AM
formatting issue scrabtree[_2_] Excel Programming 2 August 5th 04 01:52 PM


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