Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Conditional Formatting

Looking to format complete row (all used cells) GREEN,
if date in column B is older than today()
I have the Workbook.Open event, but am lost with the module code.
It should loop thru the code every time the workbook is opened.
I like to do it this way so no matter how long the ws gets, it will "work".
So I guess we would need to find the end of each row, as well as the
end of the columns.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default Conditional Formatting

Hi,
This code isn't elegant, but it seems to work.

Sub Turn_Green()
Dim CountColumns As Double
Dim CountRows As Double
Dim Rng As Range
Dim Iloop As Double
CountColumns = Range("IV1").End(xlToLeft).Column
CountRows = Range("A65536").End(xlUp).Row
For Iloop = 1 To CountRows
If Cells(Iloop, "B") Date Then
Set Rng = Range("A" & Iloop)
Rng.Resize(1, CountColumns).Interior.ColorIndex = 4
End If
Next Iloop
End Sub

--
Ken Hudson


"BEEJAY" wrote:

Looking to format complete row (all used cells) GREEN,
if date in column B is older than today()
I have the Workbook.Open event, but am lost with the module code.
It should loop thru the code every time the workbook is opened.
I like to do it this way so no matter how long the ws gets, it will "work".
So I guess we would need to find the end of each row, as well as the
end of the columns.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Conditional Formatting

Your Correct - It isn't Elegant.
But, Once I turned the greater than to less than,
it works exactly as I need it.
Thanks much for the prompt response.

"Ken Hudson" wrote:

Hi,
This code isn't elegant, but it seems to work.

Sub Turn_Green()
Dim CountColumns As Double
Dim CountRows As Double
Dim Rng As Range
Dim Iloop As Double
CountColumns = Range("IV1").End(xlToLeft).Column
CountRows = Range("A65536").End(xlUp).Row
For Iloop = 1 To CountRows
If Cells(Iloop, "B") Date Then
Set Rng = Range("A" & Iloop)
Rng.Resize(1, CountColumns).Interior.ColorIndex = 4
End If
Next Iloop
End Sub

--
Ken Hudson


"BEEJAY" wrote:

Looking to format complete row (all used cells) GREEN,
if date in column B is older than today()
I have the Workbook.Open event, but am lost with the module code.
It should loop thru the code every time the workbook is opened.
I like to do it this way so no matter how long the ws gets, it will "work".
So I guess we would need to find the end of each row, as well as the
end of the columns.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Conditional Formatting

BTW, you wouldn't happen to be the Ken Hudson, formerly of GROVE
in the Royal City next door to the big family with all the blondies?
Wouldn't that be a strange coincidence.

"Ken Hudson" wrote:

Hi,
This code isn't elegant, but it seems to work.

Sub Turn_Green()
Dim CountColumns As Double
Dim CountRows As Double
Dim Rng As Range
Dim Iloop As Double
CountColumns = Range("IV1").End(xlToLeft).Column
CountRows = Range("A65536").End(xlUp).Row
For Iloop = 1 To CountRows
If Cells(Iloop, "B") Date Then
Set Rng = Range("A" & Iloop)
Rng.Resize(1, CountColumns).Interior.ColorIndex = 4
End If
Next Iloop
End Sub

--
Ken Hudson


"BEEJAY" wrote:

Looking to format complete row (all used cells) GREEN,
if date in column B is older than today()
I have the Workbook.Open event, but am lost with the module code.
It should loop thru the code every time the workbook is opened.
I like to do it this way so no matter how long the ws gets, it will "work".
So I guess we would need to find the end of each row, as well as the
end of the columns.



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
How can I convert conditional formatting into explicit formatting? Patrick Harris Excel Discussion (Misc queries) 0 April 9th 09 12:00 AM
Conditional formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


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