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...
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top