I decided to add more some more functionality to my Application Settings addin. In fact, I also changed the name to Excel Settings. (It's actually a different file, so please be sure to click "Check settings when opening/saving files" on the menu if you want these to fire).
What's new? As you can see, I added 2 new sections for Workbook Scope and Worksheet Scope settings. The picture pretty well speaks for itself.
And, if your file is saved (has a path), you can see File Size, Last Saved (Date and Time) and Last Edit (Author) details.
I made a new version of my Application Settings addin as per Sébastien's comments in my last post (mirrored on the Daily Dose of Excel).
As you can see, there are new settings for the following.
In the case of the last 2 settings, you'll notice that there are Set, Reset and Save buttons. This is how they work,
Set: Set to the number that is entered in the text box.
Reset: Reset to the real default or “alias” default.
Save: Save an “alias” default instead of Excel’s real default. For example, if you prefer 120 instead of 100 for Max Iterations, you can set the “alias” default so that the form does not appear when opening or saving the active workbook if Application.MaxIterations is set to 120. Also, clicking the Reset button thereafter will reset Application.MaxIterations to 120. And using the Set button to set Application.MaxIterations to any other value than 120 will show the value in red font to indicate it is not the “alias” default.
Hope this is useful. Download the new version here.
Back in 2005, I noticed something that worried me.
You may know already that switching Application.Calculation to xlCalculationManual can make various code run faster. It can be a big time saver.
The problem, as I see it, is not switching it back to xlCalculationAutomatic. Given that some people for whatever reasons might use Manual Calculation all the time, most people don't, especially the vast majority of average users who probably haven't heard of this setting. With Calculation still set to Manual, they might be looking at values that haven't be updated. Even experienced programmers might be temporarily confused until they figure out what's going on. Imagine someone in a sales department quoting incorrect pricing to a customer or doing a faulty presentation at an important meeting. Not good.
And now for what really worries me - saving files with this setting. Let's try something. Close all Excel files, except one to use for testing. Now switch to Manual Calculation. If you don't know how to do it in code, you can click Calculation Options on the Formulas tab, then select Manual. Now save in that setting, close Excel, and reopen the file. If that file is the first one to be opened, Excel Calculation will be set to Manual by default, and all other files opened thereafter will be affected too. Save any of them with this setting, and the same thing will happen if they happen to be the first file opened...
So, how do you know Calculation is set to Manual without specifically checking?
Now, imagine sending one of these files to colleagues or customers, then realizing something is amiss days later. Again, not good. In fact, downright scary.
So, also in 2005(?), I made an addin called Calculation Checker. It checks Calculation when you save and prompts you to do so as Automatic if set as otherwise (including Automatic Except for Data Tables).
I've found it useful, but since then I've thought there's room for improvement, so I made something new.
As you can see there's 3 menu items. The bottom 2, when toggle to "On", check files when opened/saved for the following settings.
If any of those settings are not at their default, the Application Settings form will be displayed. Non-default settings are displayed in red. (Yes, the first 3 should be obvious, but easy enough to miss if you're busy, tired or both!)
Click the form's controls to reset them individually, or just click the Reset Everything button, then the Save File and Exit button if you choose to. Alternatively, click the X button not to save the file. Note that any other file that are open will also be saved with these settings (unless you change them later), because they are Application settings, not Workbook settings.
And because the form can be opened directly from the Ribbon, you can easily change any of the settings at any time for whatever reason. Click the Show Settings button and you can see other settings that can also be reset when clicking the Reset Everything button, if the Include other settings checkbox is ticked.
Note Keep in mind that these additional settings aren't checked automatically. The form only resets them if you click the Reset Everything button as mentioned above. Also, if Application.EnableEvents is set to False by VBA code, my addin won't check files when opening or saving as these are the events that trigger it. In fact, you should be setting this False if any of your code does open or save workbooks to prevent my code from running, then set it back to True before the code ends.
Hopefully this tool will be of use. You can download it here.
At a former client, I was asked to submit monthly reports that show details of work performed in 15 minute increments.
This is what I came up with. My line of thought went something like this,
"Let's see, a monthly calendar, something like the one on my fridge door comes to mind and making one in Excel should be easy..."
One problem is space. If I do several tasks in one day, do I use tiny font to make the details fit, or do I make the calendar larger to the point that I have to scroll copiously?
Also, just how practical is that style of calendar going to be when it comes to adding up total time? Something along the lines of a timesheet would be better.
I can easily fit 32 rows on my laptop screen. That's a good start. So here's how to do the same thing I did, if you are interested.
Leave the first row for your headers. In cells A1 and B1, enter "Date" and "Day", then change the orientation. Right click the cells, select Format Cells, Alignment, and change Orientation to 90 degrees.
(You might want to change the Alignment too. Choose from the options on the Alignment Group on the Home Tab)
Enter the first day of the month in cell A2. Select range A2:A32, then change the format to either "d/m" or "m/d" as you prefer. Right click the cells, select Format Cells, Number, and enter the format in the Type text box in the Custom section.
Now enter =A2+1 into Range A3:A32 and click your Ctrl and Enter keys simultaneously to enter the formula into all selected cells.
In the same way, enter =CHOOSE(WEEKDAY(A2,1),"Su","Mo","Tu","We","Th","Fr","Sa") into Range B2:B32.
Adjust the width of both of these columns and set the alignment to suit.
You should have something like this.
And now for the details. Long descriptions take up space, so let's use numbers instead. Keep in mind that longer tasks won't be completed in 15 minutes, and recurring tasks will be duplicated so that's going to cut down the number of tasks in total. With any luck, we can keep things within double digits.
Start times allotted for the 15 minute intervals go in Row 1. Adjust the Orientation to 90 degrees. "h:mm" is a suitable format.
The task descriptions that match the numbers can go on the right. But note the numbers to their left to perform a lookup.
Important: adjust the following ranges to suit your requirements. Use Named Ranges if you prefer.
Enter formulas to add up the time. Type the following formula into Cell AI2, and drag down to the end of your list.
=IF(COUNTIF($C$2:$AE$32,AG2)=0,"",COUNTIF($C$2:$AE$32,AG2)/4) You should have something like this.
You can freeze the first row if the number of tasks exceed the number of visible rows on your screen. (View Tab, Windows Group, Freeze Panes, Freeze Top Row)
Now for some extra features to enhance visibility. Why not add some Conditional Formatting to highlight the weekends? With Range A2:AE32 selected, click the Home Tab, Styles, Conditional Formatting, New Rule, then "Use a formula to determine which cells to format" and enter this formula. (Click the Format button to choose a suitable format)
Here's the result.
An ActiveX Combo Box and a bit more Conditional Formatting makes it easy to see when the work was done. If you can't see the Developer Tab on the Ribbon, select the File Tab, Options, Customize Ribbon, then tick "Developer" on the list to the right and click the OK button.
On the Developer Tab, select Insert from the Control Group to add an Active X Combo Box. (I've already added one to Cell AH1)
Right click the Combo Box and select Properties. Set the LinkedCell and ListFillRange properties. I've hard-coded my ListFillRange range reference but you can use Named Ranges too, as in "=Tasks" without the quotation marks.
When finished, toggle off Design Mode on the Developer Tab.
Note the linked cell. That gives me the selected item of the list. Now I use another formula to get the reference number which I have put in the cell below the linked cell (In this case, Cell AJ3).
=MATCH(AJ2,AH:AH,0)-1 If I select the first item on the Combo Box, Cell AJ3 will show 1.
Here's the Conditional Formatting for the details part of the report. (Range C2:AI32)
And here's the Conditional Formatting for the list. (Range AG2:AH32)
I also added some Data Bars to the hours.
And we're done.
No VBA was used so you can send the file without explaining the need to enable macros.
Here's a download link if you want to skip making one yourself.
This patch concerns another change to the Undo code, and is in case you unchecked "Trust access to the VBA project object model" after launching Excel. Perhaps unlikely, but I like to avoid potential bugs whenever possible.
I'm still committed to updating this version by fixing any bugs that I find, or tweaking this and that with improvements. It won't have as many features as upcoming versions, but I don't intend to abandon it either.
So, what's new?
An indenting bug was fixed for Select Case constructs when working with Projects and Modules.
I also improved the indenting of Add Line Numbers code.
When adding the date and time to text files being exported, the code has been adjusted to show the correct time.
I made a change to the Copy Code and Compare Code userforms. Sometimes duplicate file names were showing.
I edited Highlight Code In Excel so that individual Case statements are also highlighted with Select Case constructs.
Note: It is a big help to see them highlighted this way. Unfortunately I had to hard code that part, so it will only work if your tab settings are set to 4. (In the VBE, Tools, Options, Editor, Tab Width). If I find a way to determine this programatically, I will adjust the code to suit.
As a small bonus, I added the functionality to delete Debug.Assert and Stop to the Cleanup Project code.
Let's see what we have so far. Access AET VBE Tools by right clicking within the active code pane.
Here are the tools.
Indent Code Indent code within the active VB project, module, procedure or selected text.
Add Line Numbers Add line numbers to code within the active VB project, module, procedure.
Delete Line Numbers Delete line numbers from code within the active VB project, module, procedure.
Export Code Export code from the active VB project, module, procedure to text files.
Compare Code Select modules from projects.
Code from both modules will be exported to worksheets in a new workbook.
Code that exists in one module, but not the other (and vice versa) will be highlighted.
Copy Code You can copy code/modules between projects.
Standard modules, class modules and userforms will be be replaced if they exist (have the same name), or added if they don't exist.
ThisWorkbook code will be replaced.
Sheet module's code will be replaced if the sheet exists, or worksheets will be added with the new code if they don't exist.
Macro Comment Tools A handy way to add generic comments to all macros in the active project or module.
Insert Code Snippets Tired of entering the same code all the time? This makes it easier.
Run Favourite Macros Yes, you can already run them from your Personal workbook.
But now you can also export your favourite code to text files. Note: Not all code will run. This is a experimental tool, but I have found it quite useful when coding myself.
Multiple Find And Replace You can find and replace code with several fields at once. Fields are saved between sessions.
Cleanup Project Just 2 options at the moment. You can delete lines of code that have "Debug.Print", and also delete excess blank lines. (Only a single blank line will remain)
Highlight Code In Excel Export your code to a worksheet in a new workbook. Selecting cells in Column A that have keywords like If, With, Select, etc will be highlighted so you can see where that part of the code begins and ends. This is very beneficial to your mental health when trying to figure out what connects with what in those long, long procedures.
Last, but not least, there are various settings available.
That's it for now. I've already started writing code for my upcoming shareware version, and one cool new tool is already added.
Please support me by purchasing a copy when it's ready.