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

I have a spreadsheet that contains progress data in the range 0 to 1. The
data is populated from scratch from Access using VBA. I want cells to be
red if the number in the preceding column is lower, but I want to apply this
formatting from Access.

I've got an idea that the code will be some sort of loop but have no idea
what the syntax might be. Anyone done this or similar?

Many thanks.

Keith.

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

If you highlight the first cell with a value (or the second one since
you'll be referencing the cell to the left) and go into Format -
Conditional Formatting.
In the dialogue box where it says "Cell Value is" change to "Formula
is", then in the other box write "=(c10<b10)" [this is for cell c10,
change accordingly for whichever cell you're in]. Then hit the Format
button and change the colour of the cell under the Patterns tab.
The formatting should be in place for this cell. Now Copy the cell and
Paste Special - Formats across the rest of the range (except for the
first column).

Be careful when your VBA imports the data from Access that you paste
only the values and don't overwrite the formatting. In your VBA it
will be something like Range("C10").Value = [value from Access] rather
than Range("C10") = [value from Access]. I'm not sure how you're
pulling this in, but this should give you a starting point.

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

"Erasmus" wrote in message
oups.com...
If you highlight the first cell with a value (or the second one since
you'll be referencing the cell to the left) and go into Format -
Conditional Formatting.
In the dialogue box where it says "Cell Value is" change to "Formula
is", then in the other box write "=(c10<b10)" [this is for cell c10,
change accordingly for whichever cell you're in]. Then hit the Format
button and change the colour of the cell under the Patterns tab.
The formatting should be in place for this cell. Now Copy the cell and
Paste Special - Formats across the rest of the range (except for the
first column).

Be careful when your VBA imports the data from Access that you paste
only the values and don't overwrite the formatting. In your VBA it
will be something like Range("C10").Value = [value from Access] rather
than Range("C10") = [value from Access]. I'm not sure how you're
pulling this in, but this should give you a starting point.


Many thanks. I didn't realise there was already a thread with this name and
it took me ages to find it ;-)

What I really want is to have the formatting set using VBA in Access. I
need to be able to output my data to any Excel file so pre-formatting a
specific file isn't an option. Is this do-able?

Regards,
Keith.

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 Conditional Formatting Icon Sets The Rook[_2_] Excel Discussion (Misc queries) 3 March 7th 09 08:48 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 02:10 PM.

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"