Flux rss
Search : in
By : Relevance Date Username
Statut : Solved

Excel question - conditional format

wkendhacker, on Wednesday 14 May 2008 à 15:03:53
Hello,


I am trying to format excel file base on date. I have a excel file with lots rows in which a cell contains date info. I want to format it like this:
If the date in the line is less than today, change the row to red;
If the date is between today and + 7 days change the row to yellow;
If the date is greater than today + 7 days chnage the row to green;
I want to use marco so that every time I open the file it will auto update the format.
Can this be done and how?


Thanks in advance
Configuration: Windows XP
Internet Explorer 6.0
Reply to wkendhacker  Report this message to moderators Go to last message

1


  • This message seems useful, vote!
  • Report this message to moderators
aquarelle, on Wednesday 14 May 2008 à 17:32:12
Hello,
Maybe you can try this macro. I supposed that the dates were in column A, but you can modify it as you want :
Sub auto_open()
DerCell = Range("A2").End(xlDown).Address
Set MyPlage = Range("A2:" & DerCell)
Dim MyDate As Date
    MyDate = Now + 7
    
    For Each Cell In MyPlage 
        If Cell.Value < Now Then
            Cell.EntireRow.Interior.ColorIndex = 3 
        End If
        If Cell.Value >= Now And Cell.Value <= MyDate Then
            Cell.EntireRow.Interior.ColorIndex = 6 
        End If
        If Cell.Value > MyDate Then
            Cell.EntireRow.Interior.ColorIndex = 4
        End If
        
    Next
End Sub

I hope this will help you.
Bye
"Pour trouver une solution � ses probl�mes, il faut s'en donner la peine."
Reply to aquarelle

4


  • This message seems useful, vote!
  • Report this message to moderators
Rebecca, on Wednesday 23 July 2008 à 04:36:27
Dear Aquarelle,

I am relativley new at VBA - I can write very very basic code & I am trying to help a co-worker to make life a bit easier for her.
She has a spreadsheet with two colums of data - one is dates/times & the next one is an advertising code.
I initaly set up conditional formating for her but she often has more than three diffrent advrtsier codes.
So i figured we needed a macro that could do lots of diffrent advrtiser codes.
I have been trawling the internet for days trying to find a code that would help me & yours is the only one that comes close to doing what i need to do. yet not quite i have played around with yours & tried to modify it to what i want to do, but i keep getting syntax errors & compile errors.

I figure I am going wrong around the Dim area but not sure.

basically what i want to do is:

search through collum B & if it finds a certian advrtiser code it changes the font of that row to Red (for example).
I want to be able to have it search for as many advertiser codes as possible & change them all to diffrent colours.

Do you have any suggestions that may be able to help me?
I would be eternaly gratefull!

Kindest Rebecca
Reply to Rebecca

7


  • This message seems useful, vote!
  • Report this message to moderators
yabadabadoo, on Friday 31 October 2008 à 21:59:13
Hello,

I have an excel file with a list of 50 suppliers in col A, in col B is a deadline date they have to submit their report by.
In col C is the supplier email address.
Can you please advise me on how to set up macro so when we approach the deadline date, a email is sent to
the supplier to remind them to submit their report asap.
I am new to macros, can you please HELP!
Reply to yabadabadoo

8


  • This message seems useful, vote!
  • Report this message to moderators
Aimy, on Tuesday 18 November 2008 à 14:45:31
Thanks a lot aquarelle!

Now I want to extend my question based on your script.

What if that value that I want to based on if coming from a list range and I've already format that range accordingly.

Meaning that, let's say I have these 3 list of values (CODE):
AIR (blue font, yellow background)
API (red font, rose background)
AST (black font, orange background)

And my target is to automatic color each row (within a range - not the entire row) which have 4 columns - date, subject, remark and CODE (same as above).

This is the sample file - http://www.speedyshare.com/930276611.html

Can you please help me.

Your help is so much appreciated.

Thank you.
Reply to Aimy

9


  • This message seems useful, vote!
  • Report this message to moderators
aquarelle, on Wednesday 19 November 2008 à 00:19:12
Hi,
I hope this will correspond to your expectation : http://www.speedyshare.com/401317423.html
Best regards "Pour trouver une solution � ses probl�mes, il faut s'en donner la peine."
Reply to aquarelle

10


  • This message seems useful, vote!
  • Report this message to moderators
aimy, on Wednesday 19 November 2008 à 00:33:22
Thanks a lot aquarelle!!

But actually that is not exactly what I want.

Please refer to my new attachment..

http://www.speedyshare.com/259873304.html

Based on your script, I modify it to this:
Sub auto_open()
DerCell = Selection.Range("A2").End(xlDown).Address
Set MyPlage = Selection.Range("A2:" & DerCell)
Dim MyDate As Date
    MyDate = Now + 7
    
    For Each Cell In MyPlage
        If Cell.Value = [D10] Then
            Cell.EntireRow.Font.ColorIndex = [D10].Font.ColorIndex
            Cell.EntireRow.Interior.ColorIndex = [D10].Interior.ColorIndex
        End If
        If Cell.Value = [D11] Then
            Cell.EntireRow.Font.ColorIndex = [D11].Font.ColorIndex
            Cell.EntireRow.Interior.ColorIndex = [D11].Interior.ColorIndex
        End If
        If Cell.Value = [D12] Then
            Cell.EntireRow.Font.ColorIndex = [D12].Font.ColorIndex
            Cell.EntireRow.Interior.ColorIndex = [D12].Interior.ColorIndex
        End If
        
    Next
End Sub


My objective here now is actually to color the table A2:C7 based on the value of the code that falls under the column A.

That value is actually a code retrieve from the list of values D10:D25

So, depending on the value of the code in column A, I want the respective row to be colored exactly as the code itself (D10:D25).

My current script now color the entire row which I do not want it to be that way. I only want the row to colored up to column C only.

Your help is so much appreciated.

Thank you so much for your assistance.
Reply to aimy

11


  • This message seems useful, vote!
  • Report this message to moderators
aquarelle, on Wednesday 19 November 2008 à 01:44:53
I hope it will be all right like that : http://www.speedyshare.com/383182639.html
See you soon "Pour trouver une solution � ses probl�mes, il faut s'en donner la peine."
Reply to aquarelle

12


  • This message seems useful, vote!
  • Report this message to moderators
aimy, on Wednesday 19 November 2008 à 03:23:45
Thank you so much!!!!!!!!

Actually my real case in this:

http://www.speedyshare.com/752228631.html

Please refer to the Sheet2.

That is what I want to achieve actually. I want to automatic color my ATM bank transaction based on the code.

So, I have modify your script a bit and now it is partially working.

The problem occurs when there's no value for the code.

It will only work perfectly where all rows are filled up with code.

I just want it to be more flexible if it can - preferably if it can work within selection.

Right now when it first notice a blank code, it will stop.

Anyway, what I achieved now is enough to make me happy.

Thank you so much again. :) :) :)
Reply to aimy

13


  • This message seems useful, vote!
  • Report this message to moderators
aimy, on Wednesday 19 November 2008 à 03:27:11
And one more thing..

It overwrites the cell border.. :(

I've already make a border to denote a transaction for a particular month.

Thank you.
Reply to aimy

14


  • This message seems useful, vote!
  • Report this message to moderators
 aimy, on Wednesday 19 November 2008 à 03:40:52
Sorry about my previous message. I was wrong.

It didn't interfere the border formatting, it was my mistake.

Sorry and thanks.
Reply to aimy

3


  • This message seems useful, vote!
  • Report this message to moderators
RazeenAbdullaxp, on Wednesday 14 May 2008 à 20:26:11
Hai



May I suggest that you look up IF statements in Excel Help so you'll understand the "value if true", "value if false" mechanism?
Then Google Nested IF for a deeper understanding.

Basically, you only want the Conditional Formatting to check the date if the cell is not empty and a Nested IF formula handles that nicely.

IF the cell is not empty, then IF the date is <TODAY()...

=IF($A1<>"",IF($A$1<TODAY(),TRUE, FALSE))
Reply to RazeenAbdullaxp

6


  • This message seems useful, vote!
  • Report this message to moderators
Bhavin Shah, on Friday 31 October 2008 à 07:22:07
hi,
I was looking for a format of the attendance sheet where a workers time in or late or absentism is supposed to be entered
i have tried conditional formatting for the colour change
but there is some problem there are not more than three options available in these case
Other than this when i use the function of time in =IF(ISBLANK(J13)," ",IF(J13>10:30,"Late","Present"))
i dont get an option to mark "absent"
CAn you elp me in this?
Thankyou in advance
Reply to Bhavin Shah

Résultats pour Excel question conditional format

Conditional Format Problem Hello, I want to use Excel Conditional Format to change color of an entire row whenever there is a "cancel" placed in any of the cells in that row. All other information involves taking a value from a column entry, and not a row entry. We have daily... en.kioskea.net/forum/affich-10118-conditional-format-problem
Conditional Formatting with expiry dates Hello, I am working on a large excel spreadsheet full of training records. I have managed to use conditional formatting to highlight when a course has expired. However I am struggling to highlight when a course is due to expire within 3 months of... en.kioskea.net/forum/affich-20294-conditional-formatting-with-expiry-dates
Conditional Formatting I need to specify different text colours for certain conditions. This I can do with the conditional formatting but only for three conditions, I have tried to write some VBA code to allow me to call two or more routines to get more conditions The code... en.kioskea.net/forum/affich-26380-conditional-formatting

Résultats pour Excel question conditional format

How to convert Excel into PDF?How to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. PDF995 is software that gets installed on your computer which enables you to print any sources of document to PDF.... en.kioskea.net/faq/sujet-552-how-to-convert-excel-into-pdf
Formatting articles of the knowledge baseFormatting articles of the knowledge base /!\Be careful /!\ : Don't do a copy/paste of a tip found on another website : First of all, it's unuseful since the same tip is twice on internet. Moreover it's possible that there's a copyright on... en.kioskea.net/faq/sujet-63-formatting-articles-of-the-knowledge-base

Résultats pour Excel question conditional format

Conditional formatting problemsHello, I have a office 2003 instalaltion and none of the conditional formatting is working. I also created a new sheet and applied conditional formatting but the cells stays as is. No formatting is applied. en.kioskea.net/forum/affich-13623-conditional-formatting-problems
Conditionally changing row background colorHi I want to change the background color of the rows in my Excel worksheet based on the value of a certain column named 'Status'. Status can have around 7 values Conditional Formatting might not be the right choice. Following are the values... en.kioskea.net/forum/affich-27450-conditionally-changing-row-background-color
Conditional Formatting (more than 3) in ExcelHello, i am trying to apply more than three options to excel that changes the background colour of the cell. my range is R7:R1000 i need a VBA or macro that will change the background colour of the cell as follows if cell reads "Extreme", change... en.kioskea.net/forum/affich-21716-conditional-formatting-more-than-3-in-excel

Résultats pour Excel question conditional format

Download MP3-CheckFormat MP3 is audio format par excellence for audio compression. But it is really possible that there are errors in formats, notably graffiti there. MP3-Check is an application which allows to prove your music collection for quality and possible... en.kioskea.net/telecharger/telecharger-696-mp3-check
Download LiveProject Free Project ViewerLiveProject is an application of visualization of file mpp free. LiveProject introduces no degradation of the file mpp during exportation in format Excel or html. With LiveProject, you will be able to print your own documents. The use of LiveProject... en.kioskea.net/telecharger/telecharger-860-liveproject-free-project-viewer
Download Before DVD/DivX PlayerFormat DivX is the format of compression par excellence of files DVDs. He allows to acquire the third of the initial size of the video file DVD. Artisan DVD and DivX Player is a reader intended for format DVD and DivX with technology Microsoft... en.kioskea.net/telecharger/telecharger-566-before-dvd-divx-player

Résultats pour Excel question conditional format

General Terms and Conditions of Use All Rights Reserved - 2007 - Quidéa Object These General Terms and Conditions are meant to define the ways in which the services of the website en.kioskea.net, hereafter "The Service," are made available, as well as the conditions of use of the... en.kioskea.net/ccmguide/cgu-conditions-generales.php3
Spreadsheets - The Excel Interface Microsoft Excel is the spreadsheet in the Microsoft Office office suite. To start it, simply click on the appropriate icon in the Start menu (in Windows) or click on an Excel file (that has an .xls file extension). A Excel document is called a file... en.kioskea.net/tableur/tabinterface.php3