S4 / RS4 (B5 Platform) Discussion Discussion forum for the B5 Audi S4 & RS4 produced from 1998-2002

Excel Macro help requested - How to change cell background color based on value in cell? ....

Thread Tools
 
Search this Thread
 
Old 08-04-2004, 08:13 AM
  #1  
AudiWorld Expert
Thread Starter
 
Mark P's Avatar
 
Join Date: Mar 2000
Location: Raleigh, NC
Posts: 29,189
Received 5 Likes on 5 Posts
Default Excel Macro help requested - How to change cell background color based on value in cell? ....

As I log data in my Audi, I end up with .csv files. I'd like a way that I could open up these files, apply some saved macro (or whatever) and have the following things happen automatcially:

1.) Set the background color of any cell to Yellow in Row X if the value is > 90.

2.) Delete Row "x" if the value of the cell at Row "x", Column "y" is < some value "z". In other words, delete a given row it's value for a certain column is less than something.

3.) Save the newly created file with the same name, but with an .xls extension to support the colors that have been added.

I've peeked around the Excel help, but can't figure out how to do these things. Any help greatly appreciated.

Thanks,
Old 08-04-2004, 08:22 AM
  #2  
Audiworld Sponsor
 
DAP@EPL's Avatar
 
Join Date: Jun 2000
Posts: 19,700
Likes: 0
Received 0 Likes on 0 Posts
Default Well...

You could set up a macro do do that stuff, but macros are typically stored in the .xls files themselves (.csv couldn't contain a macro since its just a text file). So you'd have to convert to a .xls file, import the macro (either from another .xls file or just saved on your HD) and then run it.

Alternatively (and I think this is more what you are looking for), you can write an Add-In for Excel so that the functionality exists from within Excel itself and can be applied to any open file (i.e., the .csv log). Thats a bit more involved than a simple macro.

-Dave Pramanik
Old 08-04-2004, 08:32 AM
  #3  
AudiWorld Super User
 
WindyCityS4's Avatar
 
Join Date: Mar 2003
Posts: 7,550
Likes: 0
Received 0 Likes on 0 Posts
Default Maybe this.....

1. Select the data you want to apply this to.
2. Format menu
3. Conditional Formatting
4. Leave first box as "Cell value is"
5. Pick condition in next box, i.e. "greater than"
6. Enter value into 3rd box, i.e. 90
7. Pick format option using "Format" button. (Yellow fill)

This is what i do. Not too long, but not as speedy as a macro.
Old 08-04-2004, 08:53 AM
  #4  
AudiWorld Senior Member
 
Pie4Foo's Avatar
 
Join Date: Jun 2003
Posts: 1,618
Likes: 0
Received 0 Likes on 0 Posts
Default I'd recommend this as well. I'm not entirely sure a macro is necessary, unless

...it's part of a larger program or process.
Old 08-04-2004, 09:00 AM
  #5  
AudiWorld Senior Member
 
Rian Colorado's Avatar
 
Join Date: Dec 2001
Posts: 1,144
Likes: 0
Received 0 Likes on 0 Posts
Default Piece of cake

The conditional formatting answer above is correct. You can setup a simple macro for importing the .csv file too. If you want, e-mail me the CSV file and I'll do it for you. It'll take me about 5 minutes.
Old 08-04-2004, 09:01 AM
  #6  
AudiWorld Expert
Thread Starter
 
Mark P's Avatar
 
Join Date: Mar 2000
Location: Raleigh, NC
Posts: 29,189
Received 5 Likes on 5 Posts
Default

Mail incoming - thanks!
Old 08-04-2004, 12:36 PM
  #7  
Banned
 
ModifiedA4's Avatar
 
Join Date: Mar 2000
Posts: 34,209
Likes: 0
Received 2 Likes on 2 Posts
Default re:

dim value as variant

value = range("A1")

if value >90 then

range("a1").select

With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With


end if
Old 08-04-2004, 12:39 PM
  #8  
Banned
 
ModifiedA4's Avatar
 
Join Date: Mar 2000
Posts: 34,209
Likes: 0
Received 2 Likes on 2 Posts
Default

i can code the rest if you want...(the deleting and saving, its pretty straight forward)
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
alexbelcher
A4 (B8 Platform) Discussion
0
02-04-2019 06:46 AM
drx604
Q7 MK 1 Discussion
4
12-02-2007 09:15 AM
paulroad
NY / NJ / CT Discussion
5
11-22-2006 07:46 AM
RLS
A6 / S6 (C6 Platform) Discussion
5
06-08-2006 01:43 PM
Reggie
Rocky Mountain Discussion
5
02-07-2006 09:29 AM



Quick Reply: Excel Macro help requested - How to change cell background color based on value in cell? ....



All times are GMT -8. The time now is 06:37 AM.