How to get a numeric value of the last Friday of the month

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.

Row 2 Column A: Price on the last Friday of previous month
Row 2 Column B: Yesterday's price
Row 2 Column C: Today's price

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

However, when it is a new month, I have to always update Row 2 Column A manually.

Is there a way for my macro to determine if today is the first Monday of the month and if it is, copy and paste the values in Row 2 Column B as well as Row 2 Column A?

I hope this makes sense...

TIA
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
=IF(AND(TEXT(TODAY(),"ddd")="Mon", DAY(TODAY())<8, "First Monday of the month", "other")

Thank you for the response.

I pasted the below into my MACRO but it gives me an error.. (Cell N2 contains a date)

If Text("N2", "ddd") = "Mon" And Day("N2") < 8 Then

What am I doing wrong here?
 
Last edited:
Upvote 0
You need to reference the value of the cell N2, not the string "N2".
Also, Format is the VBA equivalent of the worksheet function TEXT.

Code:
If Format(Range("N2").Value, "ddd") = "Mon" And Day(Range("N2").Value) < 8 Then
 
Upvote 0
Re: How to get a numeric value of the last WEEKDAY of the month

I actually asked the wrong question in my original post..

What I meant to ask was relating to last WEEKDAY of the month and/or first WEEKDAY of the month..

So I ask again as below:

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.

Row 2 Column A: Price on the last WEEKDAY of previous month
Row 2 Column B: Yesterday's price
Row 2 Column C: Today's price

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

However, when it is a new month, I have to always update Row 2 Column A 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 Row 2 Column B as well as Row 2 Column A?

I hope this makes sense...

TIA
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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