View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.misc
Colin Hayes Colin Hayes is offline
external usenet poster
 
Posts: 465
Default Extending existing coding to include new parameters

In article , GS writes
Well, I think you're gonna have to look at getting involved with multiple properties
and lots of
character manipulation. I've never had any need to do this programmatically so try
doing it manually
with the macro recorder and see what, if any, code generates.

You might be better off just setting the cell's font to green for times that fall into
open hours.

--
Garry


Hi Garry

OK thanks for that. I do now realise that colour is complicated. I've
seen your further message , and will have a go at this. Very
interesting.

I made an error in my earlier email. Or rather overlooked a parameter.
Apologies.

My 'shop' is closed at weekends , so the TimeValue in the function would
need to return 'Closed' on Saturdays and Sundays.

Function Get_ShopOpenStatus(CurrentTime As Variant) As String
Dim vShopOpens, vShopCloses
vShopOpens = TimeValue("8:00 AM")
vShopCloses = TimeValue("4:30 PM")
If CurrentTime vShopOpens And CurrentTime < vShopCloses Then _
Get_ShopOpenStatus = "open." Else Get_ShopOpenStatus = "closed."
End Function

I'm trying to include a 'Weekday' function in the code presently.



Best Wishes


Colin