Vba to gray out weekends when dates are seperated.

LOZ1962

New Member
Joined
Dec 3, 2020
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have a year to view calendar,in a grid format 31 days accross the top & months down the a: column I would like to use VBA to grey out weekends. I have tried every formula I can find with very limited success as they do not know what year or month it is. They grey out days 6/7 in all months.. 4 days I've been trying to do this Thanks for looking & any help given. Regards Loz Baker (58 years old & still learning.)
 

Attachments

  • Holidate.jpg
    Holidate.jpg
    168.3 KB · Views: 24
In that case just use
Excel Formula:
=DAY(EOMONTH(DATE($A$2,MONTH($A3&1),$B$2),0))<B$2
 
Upvote 0
Solution

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In that case just use
Excel Formula:
=DAY(EOMONTH(DATE($A$2,MONTH($A3&1),$B$2),0))<B$2
Thank you so much, I am sure I tried that variation from the earlier formula with no success. thanks again.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,233
Messages
6,123,772
Members
449,123
Latest member
StorageQueen24

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