Archive for the ‘UDF’ Category

Calculate Working Hours in VBA

Tuesday, June 24th, 2008 2,031 views

In the spirit of my last post Calculate Working Days Minus Holidays in VBA, here is a function I wrote recently that returns the number of working hours between two date/time values passed to the function as arguments. It is self-contained and works independently of whatever existing code you have, ...

Calculate Working Days Minus Holidays in VBA

Tuesday, June 17th, 2008 998 views

I was looking for a function that calculates working days, minus holidays, for a small project I've been working on. I decided to write one myself, but below I've also demonstrated an alternate way that uses the ATP (Analysis ToolPak) functions for VBA.   Function WorkDays(StartDate As Variant, EndDate As Variant) ...

Updated blog and new pages

Tuesday, April 8th, 2008 2 views

As you may have noticed, I decided to update the blog, because it was getting hard to navigate. The color scheme was just bringing me down, so I spent about 4-5 hours changing it. That might seem like a lot of time, but I'm a perfectionist so once I start ...

UDF to return page headers/footers text

Monday, April 7th, 2008 68 views

Here's a series of short UDFs that will return the page headers and footers for the active worksheet. Function GetLeftHeader() GetLeftHeader = ActiveSheet.PageSetup.LeftHeader End Function Function GetCenterHeader() GetCenterHeader = ActiveSheet.PageSetup.CenterHeader End Function Function GetRightHeader() GetRightHeader = ActiveSheet.PageSetup.RightHeader End Function Function GetLeftFooter() GetLeftFooter = ActiveSheet.PageSetup.LeftFooter End Function Function GetCenterFooter() GetCenterFooter = ActiveSheet.PageSetup.CenterFooter End Function Function GetRightFooter() ...