Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default chosing cells with a specific colour and taking average value from

Hi,

I have cells with different colours. I want to go through a column and look
for the max.value of red cells, the average of red cells and the median of
red cells. S

So I want to ignore cells with other colours and just use cells with a
specific colour.

Can somebody help me with this? I'm very new at this, have tried for a while
now, but it's not working..







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default chosing cells with a specific colour and taking average value from

This should give you what you need

http://www.xldynamic.com/source/xld.ColourCounter.html

--
__________________________________
HTH

Bob

"Ksenija" wrote in message
...
Hi,

I have cells with different colours. I want to go through a column and
look
for the max.value of red cells, the average of red cells and the median of
red cells. S

So I want to ignore cells with other colours and just use cells with a
specific colour.

Can somebody help me with this? I'm very new at this, have tried for a
while
now, but it's not working..









  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default chosing cells with a specific colour and taking average value from

Hi,

This assumes column A. Right click your sheet tab, view code and paste this
in and run it

Sub sonic()
Dim MyRange, myrange1 As Range, c As Range
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow)
For Each c In MyRange
If c.Interior.ColorIndex = 3 Then
If myrange1 Is Nothing Then
Set myrange1 = c
Else
Set myrange1 = Union(myrange1, c)
End If
End If
redaverage = WorksheetFunction.Average(myrange1)
maxvalue = WorksheetFunction.Max(myrange1)
medianvalue = WorksheetFunction.Median(myrange1)
Next
End Sub


Mike

"Ksenija" wrote:

Hi,

I have cells with different colours. I want to go through a column and look
for the max.value of red cells, the average of red cells and the median of
red cells. S

So I want to ignore cells with other colours and just use cells with a
specific colour.

Can somebody help me with this? I'm very new at this, have tried for a while
now, but it's not working..







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default chosing cells with a specific colour and taking average value

Hi,

I'm getting a error message when I am trying to do this. It says something
like "Error nr 5, nonvalid procedurecall or argument"..

what shall I do?

"Mike H" skrev:

Hi,

This assumes column A. Right click your sheet tab, view code and paste this
in and run it

Sub sonic()
Dim MyRange, myrange1 As Range, c As Range
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow)
For Each c In MyRange
If c.Interior.ColorIndex = 3 Then
If myrange1 Is Nothing Then
Set myrange1 = c
Else
Set myrange1 = Union(myrange1, c)
End If
End If
redaverage = WorksheetFunction.Average(myrange1)
maxvalue = WorksheetFunction.Max(myrange1)
medianvalue = WorksheetFunction.Median(myrange1)
Next
End Sub


Mike

"Ksenija" wrote:

Hi,

I have cells with different colours. I want to go through a column and look
for the max.value of red cells, the average of red cells and the median of
red cells. S

So I want to ignore cells with other colours and just use cells with a
specific colour.

Can somebody help me with this? I'm very new at this, have tried for a while
now, but it's not working..







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
taking an average of every 30 cells [email protected] Excel Discussion (Misc queries) 4 August 30th 07 04:27 PM
Colour cells of specific value? rj Excel Discussion (Misc queries) 4 November 2nd 06 03:15 PM
How can I count cells of a specific colour (pattern)? Nick@Durham Excel Worksheet Functions 1 November 29th 05 10:18 AM
Counting cells with a specific background colour Duncan Excel Discussion (Misc queries) 2 June 16th 05 11:04 PM


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