Get 15 minutes of free Live Help!

How to time VBA procedures and create a log of elapsed time

This set of functions will let you track how long it took for one or more pieces of VBA code to run.  The logic includes three sections:  name and initialize the timer, end the timer, and write the results to a log file.

Here is

read more

posted on: Nov 5, 2013 | author: Carl Connett

Get total hours and minutes from summing columns of Hours and Minutes

This function can be used to return total hours or total minutes from a column of Hours and a column of Minute values.  For example, in the table below, an Hours value was captured separately from a Minutes value in a time clock application.  If

read more

posted on: Oct 22, 2013 | author: Carl Connett

Use VBA to add days to a date but exclude Saturday and Sunday

This function finds a date a certain number of days from a start date when weekends are not included. It can be used when your work week does not include Saturday and Sunday and you want to find a business day in the future. Microsoft

read more

posted on: Oct 8, 2013 | author: Carl Connett

Use VBA to get the date of the last occurrence of a weekday

This VBA function passes back the last date that a particular weekday occurred.


Public Function LastWeekDayDate(CurrentDate, LastWeekDay)
' This procedure calculates the date of the last occurrence of the day of the
' week represented by LastWeekDay.  For example, if today is Wednesday, with
read more

posted on: Apr 29, 2009 | author: Carl Connett

Convert a number to a date using VBA

This VBA procedure converts a number, in yyyymmdd format, to a regular date like mm/dd/yyyy.  For example, a number like 20090427 will get converted to 4/27/2009.


Public Function DateFromNumber(DateNumber)
' This function returns a date from the DateNumber value.
' For example, 20090109 returns 
read more

posted on: Apr 27, 2009 | author: Carl Connett

Live Chat Software