PC Review


Reply
 
 
darkbearpooh1
Guest
Posts: n/a
 
      18th Feb 2006

i am trying to color across a range of cells and i need a formula or
something
to give me a time or a number value based on the colored cells starting
cell
and finishing cell. i already have a macro that counts how many cells
are colored but can anyone help me with a formula or someting that will
tell me say for instance the colored cell's starts in cell B5 then it
would equal 5:00 but if it started in cell B6 then it would equal 6:00
also trying to give me the finishing time so based on what i said
earlier then the colored cell ends in B8 then it would equal 8:00?
Thanks!


--
darkbearpooh1
------------------------------------------------------------------------
darkbearpooh1's Profile: http://www.excelforum.com/member.php...o&userid=30640
View this thread: http://www.excelforum.com/showthread...hreadid=513916

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      18th Feb 2006
Function GetTime(rng As Range, ci As Long, Start As Boolean)
Dim cell As Range
Dim i As Long
If Start Then
For i = rng.Row To rng.Rows.Count
If rng.Rows(i).Interior.ColorIndex = ci Then
GetTime = TimeSerial(i, 0, 0)
Exit For
End If
Next i
Else
For i = rng.Rows.Count To rng.Row Step -1
If rng.Rows(i).Interior.ColorIndex = ci Then
GetTime = TimeSerial(i, 0, 0)
Exit For
End If
Next i
End If
End Function

Call it like

=GetTime(B1:B10,3,True)

start time for red cells, or

=GetTime(B1:B10,3,False)

for end time

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"darkbearpooh1" <(E-Mail Removed)>
wrote in message
news:(E-Mail Removed)...
>
> i am trying to color across a range of cells and i need a formula or
> something
> to give me a time or a number value based on the colored cells starting
> cell
> and finishing cell. i already have a macro that counts how many cells
> are colored but can anyone help me with a formula or someting that will
> tell me say for instance the colored cell's starts in cell B5 then it
> would equal 5:00 but if it started in cell B6 then it would equal 6:00
> also trying to give me the finishing time so based on what i said
> earlier then the colored cell ends in B8 then it would equal 8:00?
> Thanks!
>
>
> --
> darkbearpooh1
> ------------------------------------------------------------------------
> darkbearpooh1's Profile:

http://www.excelforum.com/member.php...o&userid=30640
> View this thread: http://www.excelforum.com/showthread...hreadid=513916
>



 
Reply With Quote
 
darkbearpooh1
Guest
Posts: n/a
 
      18th Feb 2006

That works perfect! Thanks,

But I need to modify it to work for me, How can I get it to count
across. as an example range A1-E1 instead of down ? and Also I need to
count each cell as 30 minutes if possible? Thank you!!!!


--
darkbearpooh1
------------------------------------------------------------------------
darkbearpooh1's Profile: http://www.excelforum.com/member.php...o&userid=30640
View this thread: http://www.excelforum.com/showthread...hreadid=513916

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      18th Feb 2006

Function GetTime(rng As Range, ci As Long, Start As Boolean)
Dim cell As Range
Dim i As Long
If Start Then
For i = rng.Column To rng.Columns.Count
If rng.Columns(i).Interior.ColorIndex = ci Then
GetTime = TimeSerial(Int(i / 2), (i Mod 2) * 30, 0)
Exit For
End If
Next i
Else
For i = rng.Columns.Count To rng.Column Step -1
If rng.Columns(i).Interior.ColorIndex = ci Then
GetTime = TimeSerial(Int(i / 2), (i Mod 2) * 30, 0)
Exit For
End If
Next i
End If
End Function



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"darkbearpooh1" <(E-Mail Removed)>
wrote in message
news:(E-Mail Removed)...
>
> That works perfect! Thanks,
>
> But I need to modify it to work for me, How can I get it to count
> across. as an example range A1-E1 instead of down ? and Also I need to
> count each cell as 30 minutes if possible? Thank you!!!!
>
>
> --
> darkbearpooh1
> ------------------------------------------------------------------------
> darkbearpooh1's Profile:

http://www.excelforum.com/member.php...o&userid=30640
> View this thread: http://www.excelforum.com/showthread...hreadid=513916
>



 
Reply With Quote
 
darkbearpooh1
Guest
Posts: n/a
 
      18th Feb 2006

Thats great! but the problem i am running into now is my coloring of
cells for the time starts at 6:00 or 6am but the furthest I can start
my coloring is in column F so it = 3:00 or 3am using the calling
=GetTime(A28:AQ28,36,TRUE) A=12 by the time you get to F it is only 3am
so is there a way to start column F at 6:00 or 6am?


--
darkbearpooh1
------------------------------------------------------------------------
darkbearpooh1's Profile: http://www.excelforum.com/member.php...o&userid=30640
View this thread: http://www.excelforum.com/showthread...hreadid=513916

 
Reply With Quote
 
darkbearpooh1
Guest
Posts: n/a
 
      19th Feb 2006

I figured it out i just had to add more columns in the start at column A
and shirnk the width down to zero so it wasn't visable This is so
awsome! Thank you so much for the help Bob couldn't have gotten this
far without your help! Everyone on this site is awsome!!! now i am
going to post another question because i need to figure out how to
change the time format from going to military time as in 13:00 and just
loop as 1:00 again


--
darkbearpooh1
------------------------------------------------------------------------
darkbearpooh1's Profile: http://www.excelforum.com/member.php...o&userid=30640
View this thread: http://www.excelforum.com/showthread...hreadid=513916

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom color for font color and or background shading color Ben Microsoft Excel Programming 2 5th May 2010 02:32 PM
RE: Color Codes: Different color with same color Index Ryan H Microsoft Excel Programming 0 5th Feb 2010 04:46 PM
color transition (color changes from dark color to light color) color transition Microsoft Powerpoint 2 21st Nov 2009 12:21 PM
AIO color & BW print, color & BW copy, pcfax, color scan A. L. Shaw, MD Printers 2 14th Jan 2006 04:44 AM
Fill Color/ Background Color/Tab Color M.Cave Microsoft Excel Misc 2 11th Oct 2004 02:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:13 PM.