Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default What do I need to add to my macro to make the cell colors change

What do I need to add to the macro listed below to make the cell colors
change to yellow after 1 day change and to red after 2 days?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default What do I need to add to my macro to make the cell colors change

"Bojames" wrote:

What do I need to add to the macro listed below to make the cell colors
change to yellow after 1 day change and to red after 2 days? Below is the Macro.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("C2:C1000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default What do I need to add to my macro to make the cell colors change

This event procedure runs when someone changes a value in C2:C1000.

If the user doesn't change a value in that range, then this macro won't do
anything.

Maybe you could add format|conditional formatting to that range that compares
the dates in column D with =today() (or =now()).

I would do it manually as a one time setup.

But if you wanted, you could record a macro and actually add that conditional
formatting to the cells in column C.

Bojames wrote:

"Bojames" wrote:

What do I need to add to the macro listed below to make the cell colors
change to yellow after 1 day change and to red after 2 days? Below is the Macro.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("C2:C1000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default What do I need to add to my macro to make the cell colors chan

Thanks for the advice. After I posted this I changed my mind. I need it to do
three colors at intervals of 8 hours.

"Dave Peterson" wrote:

This event procedure runs when someone changes a value in C2:C1000.

If the user doesn't change a value in that range, then this macro won't do
anything.

Maybe you could add format|conditional formatting to that range that compares
the dates in column D with =today() (or =now()).

I would do it manually as a one time setup.

But if you wanted, you could record a macro and actually add that conditional
formatting to the cells in column C.

Bojames wrote:

"Bojames" wrote:

What do I need to add to the macro listed below to make the cell colors
change to yellow after 1 day change and to red after 2 days? Below is the Macro.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("C2:C1000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default What do I need to add to my macro to make the cell colors chan

And xl2003 and below provide up to 3 different conditional formats for you.

Bojames wrote:

Thanks for the advice. After I posted this I changed my mind. I need it to do
three colors at intervals of 8 hours.

"Dave Peterson" wrote:

This event procedure runs when someone changes a value in C2:C1000.

If the user doesn't change a value in that range, then this macro won't do
anything.

Maybe you could add format|conditional formatting to that range that compares
the dates in column D with =today() (or =now()).

I would do it manually as a one time setup.

But if you wanted, you could record a macro and actually add that conditional
formatting to the cells in column C.

Bojames wrote:

"Bojames" wrote:

What do I need to add to the macro listed below to make the cell colors
change to yellow after 1 day change and to red after 2 days? Below is the Macro.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("C2:C1000"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub


--

Dave Peterson


--

Dave Peterson
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
change cell colors for 2 seconds ricowyder New Users to Excel 3 June 5th 07 01:31 PM
Condit Format? Make date change colors tkg Excel Worksheet Functions 6 February 13th 07 07:21 PM
How to have row color change based on one cell to 4 colors Mel Excel Discussion (Misc queries) 1 September 20th 06 10:47 PM
If a cell is a certain word I would like it to change colors. Mike Excel Discussion (Misc queries) 2 January 25th 06 07:57 PM
macro used to change colors Brian in FT W. Excel Worksheet Functions 12 June 7th 05 06:30 PM


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