Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default How do i auto fill cell color based on other cells' color?

Hello to everyone! :-)

This is what i want to do.. For example there is a table with columns A and B.

When i manually fill cell A2 with green color, i want that to automatically fill cell B2 with green color as well..

I think it requires VBA but i'm not a programmer..
So if you please help me, it's work related and it would help me a lot!!

Thank you very much!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default How do i auto fill cell color based on other cells' color?

On Tuesday, May 22, 2012 10:44:44 AM UTC+2, Kchatzi wrote:
Hello to everyone! :-)

This is what i want to do.. For example there is a table with columns A
and B.

When i manually fill cell A2 with green color, i want that to
automatically fill cell B2 with green color as well..

I think it requires VBA but i'm not a programmer..
So if you please help me, it's work related and it would help me a
lot!!

Thank you very much!




--
Kchatzi


Hi,

I'm not a specialist, possible that there is a better approach, but tried following code.

copy & paste following code in your worksheet module

Option Explicit
'first we define 2 static row pointers
Dim OldRow As Long
Dim NewRow As Long

Private Sub Worksheet_Activate()
'when this worksheet becomes active, save the actual rownumber into OldRow
OldRow = ActiveCell.Row
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'save the actual rownumber into NewRow
NewRow = ActiveCell.Row
'if for example OldRow= 0, then preset it to the first row
If OldRow = 0 Then OldRow = 1
'following code works for the cells A1 to A65535
If Not Intersect(Target, Range("A1:A65535")) Is Nothing Then
If Cells(OldRow, 1).Interior.ThemeColor = 0 Then
'we deal with the standard colors
Cells(OldRow, 2).Interior.ColorIndex = Cells(OldRow, 1).Interior.ColorIndex
'we deal with the new theme colors from Excel 2007 / 2010
Else
With Cells(OldRow, 2).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = Cells(OldRow, 1).Interior.ThemeColor
.TintAndShade = Cells(OldRow, 1).Interior.TintAndShade
.PatternTintAndShade = 0
End With
End If
OldRow = ActiveCell.Row
End If
End Sub

NOTE:
1) Its not flawless!
2) Even you can use the standard colors, i don't recommend it because the colors aren't the same, even the colorindex is the same - don't know why.
So i recomment to use the theme colors from Excel 2007 / 2010

Success.
Ludo

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
Summing cells within a column based on cell fill color Jim D. New Users to Excel 2 October 8th 08 04:56 PM
How I auto fill a cell patern or color based on a pick list? bbjr Excel Discussion (Misc queries) 3 April 21st 08 07:50 PM
auto color fill cells Chopper New Users to Excel 6 March 6th 06 03:04 AM
change fill color of a range of cells based on color of a cell? DarMelNel Excel Programming 0 March 2nd 06 06:35 PM
Formatting cells Auto fill color using €œIf€ Masatami Excel Worksheet Functions 4 January 13th 05 01:39 AM


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