A way for make a calendar

Leandroarb

Board Regular
Joined
Oct 7, 2014
Messages
157
Hi guys!


I share this file here, it's a simple way to make a calendar.

Download: https://drive.google.com/file/d/1BEDJLLdUajUiqh7rwwW3iUCDg1FJjOjA/view?usp=drivesdk


I use simple functions and creativity.
The loop does the opposite way of what I believe would be conventional.
When dealing with dates assembled with the year in the combobox and day and month in the listbox, the code uses the 'Me ()' operator to find the field with equal name.
Example:
The month can have up to six weeks, so for each week I have created seven fields that are the days named this way (in Portuguese):
DomSem1, SegSem1, TerSem1, QuaSem1, QuiSem1, SexSem1, SabSem1.
In English it would be:
SunWeek1, MonWeek1, TueWeek1, Wedweek1, ThuWeek1, FriWeek1, SatWeek1.


These fields are labels.


And so on to the other weeks of the month.
I use abbreviations for names not to have fields with very long names.
The functions in the loop do the following:
Code:
Day (DateSerial (Year (dtDiaPri), Month (dtDiaPri) + 1, 0)) - 1
Sets the size of the loop according to the number of days in the month.


Code:
Me (Format (dtDiaPri + j, "ddd") & "Sem"
And
Code:
DatePart ("ww", dtDiaPri + j) - DatePart ("ww", DateSerial (Year (dtDiaPri + j), Month (dtDiaPri + j), 1)) + 1) .Caption = Format d ")
Assemble the names of the labels where the days of the month will be painted. If it were today: 01/24/2018 in Portuguese it would be 'QuaSem4', in English 'WedWeek4'.

I hope it's useful.

Regards!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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