Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Fill cell based on cell value

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Fill cell based on cell value

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Fill cell based on cell value

Thanks. Is there a way to have it automatically shade without having to
manually run the macro?

"Joel" wrote:

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Fill cell based on cell value

I was wondering if there was a way to have column B automatically update as
data is updated? One week it might be less than and the next it might not.

"Kesbutler" wrote:

Thanks. Is there a way to have it automatically shade without having to
manually run the macro?

"Joel" wrote:

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default Fill cell based on cell value

You could always put the macro in under an open event or change event

"Kesbutler" wrote:

I was wondering if there was a way to have column B automatically update as
data is updated? One week it might be less than and the next it might not.

"Kesbutler" wrote:

Thanks. Is there a way to have it automatically shade without having to
manually run the macro?

"Joel" wrote:

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Fill cell based on cell value

Use a worksheet change

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("B")) Is Nothing Then
Range("B1").Copy
Target.PasteSpecial (xlPasteFormats)

End If
End Sub



"Kesbutler" wrote:

I was wondering if there was a way to have column B automatically update as
data is updated? One week it might be less than and the next it might not.

"Kesbutler" wrote:

Thanks. Is there a way to have it automatically shade without having to
manually run the macro?

"Joel" wrote:

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Fill cell based on cell value

this sort of worked but it compared all the rows in column B with the first
row in column A instead of incrementing. I need the following. If any cellin
column B is less than the corresponding cellin column A then fill cell.
row A B
1 1 2 not shaded
2 2 1 shaded
3 5 4 shaded
4 4 5 not shaded

Thanks much!



"Atishoo" wrote:

You could always put the macro in under an open event or change event

"Kesbutler" wrote:

I was wondering if there was a way to have column B automatically update as
data is updated? One week it might be less than and the next it might not.

"Kesbutler" wrote:

Thanks. Is there a way to have it automatically shade without having to
manually run the macro?

"Joel" wrote:

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Fill cell based on cell value

You conditional format formula must have a dollar sign in the formula.
Remove the dollar sign in the conditional format formula in B1.

"Kesbutler" wrote:

this sort of worked but it compared all the rows in column B with the first
row in column A instead of incrementing. I need the following. If any cellin
column B is less than the corresponding cellin column A then fill cell.
row A B
1 1 2 not shaded
2 2 1 shaded
3 5 4 shaded
4 4 5 not shaded

Thanks much!



"Atishoo" wrote:

You could always put the macro in under an open event or change event

"Kesbutler" wrote:

I was wondering if there was a way to have column B automatically update as
data is updated? One week it might be less than and the next it might not.

"Kesbutler" wrote:

Thanks. Is there a way to have it automatically shade without having to
manually run the macro?

"Joel" wrote:

use paste special with format xlPasteFormats

Range("B1").Copy
Range("B1:B100").PasteSpecial(xlPasteFormats)



"Kesbutler" wrote:

I have a number in column A and a number in column B. If column B is less
than column A, I want to fill the cell with a color. I tried conditional
formatting but it won't let me apply the formatting to all the cells in
column B at one time, I have to do each cell individually. Is there a way
(macro, formula?) that I can apply this rule to the entire column?

Thanks!

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
Auto Fill Cell Based on Data in a different cell JB Bates[_2_] Excel Discussion (Misc queries) 4 October 15th 09 04:17 PM
Fill cell colour based on input in another cell Dan Wood[_2_] Excel Worksheet Functions 2 August 20th 09 06:28 AM
How do I automatically fill a cell based on another cell in Excel SouthCarolina Excel Discussion (Misc queries) 3 January 13th 06 12:52 AM
I want to fill the cell color based upon the other cell condition sri Excel Discussion (Misc queries) 4 January 12th 06 01:47 PM
Auto-fill cell based on adjacent cell information.. sans Excel Worksheet Functions 1 October 17th 05 11:38 PM


All times are GMT +1. The time now is 08:16 PM.

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"