How to perform certain actions depending on whether it is the first WEEKDAY of the month or not.

kkamakasi

New Member
Joined
Aug 14, 2014
Messages
10
I am simplifying my excel sheet formatting just so I can ask the essential question..

I have a form that I update daily with market price of a certain commodity.
This form has three columns.

A2: Price on the last WEEKDAY of previous month
B2: Yesterday's price
C2: Today's price

I have a macro setup that I execute everyday around 5PM that does the following: Takes the value in C2 and copies into B2 and clears C2 for today's price.

However, when it is the first WEEKDAY of a new month, I have to always update A2 manually.

Is there a way for my macro to determine if today is the first WEEKDAY of the month and if it is, copy and paste the values in B2 as well as A2?

I hope this makes sense...
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

VBA Geek

MrExcel MVP
Joined
Dec 16, 2013
Messages
2,857
Is there a way for my macro to determine if today is the first WEEKDAY of the month


try

Code:
Function IS_FIRST_WEEKDAY_OF_MONTH() As Boolean
   IS_FIRST_WEEKDAY_OF_MONTH = (Day(Date) = 1 And Weekday(Date, vbMonday) < 6) Or (Day(Date) < 4 And Weekday(Date, vbMonday) = 1)
End Function
 

Watch MrExcel Video

Forum statistics

Threads
1,108,992
Messages
5,526,109
Members
409,685
Latest member
Bellybb

This Week's Hot Topics

Top