View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Changing colour of text in cell

Steve,

It's a bit difficult without seeing your code, but here is an example that
gets the input, creates the timestamp, and colours it

Dim myVal

myVal = InputBox("Supply reading")
If myVal < "" Then
With ActiveCell
.Value = myVal
.Offset(0, 1) = Now
.Offset(0, 1).NumberFormat = "dd mm yyyy hh:mm:ss"
With .Offset(0, 1)
Select Case Weekday(.Value)
Case 1: .Font.ColorIndex = 10 'green
Case 2: .Font.ColorIndex = 5 'blue
Case 3: .Font.ColorIndex = 1 'black
Case 4: .Font.ColorIndex = 6 'yellow
Case 5: .Font.ColorIndex = 21 'violet
Case 6: .Font.ColorIndex = 3 'red
Case 7: .Font.ColorIndex = 8 'turquoise
End Select
End With
End With
End If



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steve Lowe" wrote in message
...
Hi,

I'm slowly learning Excel Macro programming and would appreciate some
help with the following.

I have a Excel spreadsheet that is used at certain times of the day to
record temperature readings.

I have a input box that asks for the temperature and then puts the
value in the active cell.

The macro then automatically adds the date and time of the reading.

Each reading is on a separate row in the sheet.

What I would like to try and do is have the readings for each of the
days in the week in separate colours ie. Monday = blue, Tuesday =
Green etc.

Rather that do this manually is there any way that my macro can
include some code that changes or applies the colours to the data that
has just been entered using the value of the day of the week.

Thanks if you can offer me some guidance.

Regards

SpLoWe


- Steve Lowe
- E-Mail :
- Before Replying Remove .NO.SPAM
- UK Resident although my e-mail address is usa.net