Excel macros came to mind and I got excited to figure them out. I remembered at my first job the senior developers used them quite often so I thought "Why not teach myself?"
Before you can use macros you have to enable the "Developer" ribbon in Excel. Go to File >> Options >> Customize Ribbon and select the Developer option in the list box on the right.
Go to your worksheet and select the Developer ribbon then select Macros on the left. In the pop-up, type the macro name, select "This Workbook" option then click the Create button. The Visual Basic Editor will open but before you add code to that module, go back to your worksheet.
Select Macros again and click the Options button. Enter the shortcut key combination that you want to fire your macro. Ctrl + Shift + something else will reduce the chances of overriding any predetermined shortcuts in excel. Add a description and click OK.
Now click the Edit button on the main macro pop-up and it will take you back to the editor. Below is some code I wrote for my birthday macro. The code has to be in Visual Basic for Applications(VBA).
The code first loops through the birth date column to remove any highlights. Then it loops again to find the day and month equal to the current day and month to highlight the row of the person whose birthday it is. If there are no birthdays a message box pops up.
This was a simple and fun macro to do on excel for the first time. They can get complex and you can automate almost any repetitive task you find yourself doing on excel.
UPDATE: I've improved the macro to show upcoming birthdays as well by highlighting the rows in a different color.
No comments:
Post a Comment