View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Find last weekday of the month with vba for all months

On Sun, 23 Sep 2012 15:19:47 -0700 (PDT), Cimjet wrote:

With VBA I need to detect the last weekday of each month. I need that to trigger an event macro on the last workday of each month.
Regards
Cimjet


To detect the last workday of the month in VBA, you can use:

Dim dLastWDOM As Date
dLastWDOM = WorksheetFunction.WorkDay(DateSerial(Year(Date), Month(Date) + 1, 1), -1)
If Date = dLastWDOM Then
...