This page of the website describes how to use macro add in’s that allow you to efficiently and effectively colour you cells in an excel spreadsheet and how to efficiently copy to the right. The colouring techniques and the copy to the right macro comes from an excel file named generic macros. This file includes a macro to copy to the right SHIFT, CNTL, R and it has macro name CNTL, ALT, C where you can colour cells depending on which sheet the numbers come from.
To run these and other macros, all you have to do is have the file open because you run macros from other open files (e.g. say you are in mybook.xlsm, you can open generic macros and run any of the macros in your sheet). Note that I am in the process of modifying this file so that it works with I don’t like to take control of your computer and make add-ins. Instead, I think it is much better to just open the generic macros sheet and enable macros. Then the SHIFT, CNTL, C and the SHIFT, CNTL, R should work just fine. The generic macro file also has a lot of other macros that may be useful are included in the file that is available by clicking on the button below.
For every single one of the more than 1000 excel files on this website I have not put any passwords on the macros or functions. This means you can look at the code and try to improve it yourself. (If you have some good improvements I would really like it if you send me your work). You can also copy the macros from this file into your file or your personal workbook if you do not want to open generic macros every time you open your file.
Using the Generic Macros File to Colour Cells
I became irritated when I was going through some technical issues about circular references with a young person who seems to be very proud of the way he colours his spreadsheet. I certainly do not claim to be a financial modelling artist. But this seems to be important to many people. Because I get so irritated by people who see to think colouring is the most important skill in financial modelling; who do not use colouring to help structuring the model; and, who do not use colouring to make the model transparent I have made a colouring macro in the generic macro sheet.
To illustrate how you can use generic macros to stop wasting time with all of the silly spreadsheet art, I have made a few screen shots below do demonstrate how it works. The first screen shot shows the starting point before the CNTL, ALT, C is used from the generic macro workbook.
To use the flexible colouring options in the generic macro file, open the generic file along with the file you are working on. The press CNTL, ALT, C and a menu something like the one illustrated on the screenshot below should appear. Note that you can use this user form to run the table of contents and do other thinks like removing links to the current sheet. To implement the colouring macros, press the red button at the top right of the form.
I hope that most of the options on the options on this menu are self-explanatory. The key behind this process is that you can run the CNTL, ALT, C menu as many times as you like and press the red button to re-colour. In the left column, you can select different options for colouring direct inputs. (5*3 is not an input). The next column to the right allows you to make similar colouring selections that will apply to any item that is in the first column. If you do not use Column A for structuring your sheet, then make sure the check box next to the “Colour Column A” is not checked. Continuing to move to the right, the next set of inputs allows you to use different conditional options for TRUE and FALSE switches in your sheet. Finally the column to the right allows you to use different options for numbers that come from another sheet. When colouring cells that come from another sheet, you can use the colour of the sheet in the sheet name or you can colour anything that comes from another sheet with a green, red or blue colour.
If you want to be more flexible in colouring various cells in your sheet, you can use the flexible colouring options that are at the bottom or each section. These options are called the flexible colouring options. If you want to modify the flexible colouring options that are at the bottom of each section, you should go to the fist page of the generic macro sheet. On this sheet you can use the paint brush or copy paste special as formats to put your own formats in the sheet. After making your own colouring options, you should press the button on the generic macro page that is called Initialisation. The screenshot below illustrates the page in the generic macro sheet where you can change the colouring options.
After you have pressed the red button and colour the sheets, the page in the initial screenshot should look like the screen shot below. Note that you can keep pressing the colour sheet after you are working on your model.
Using Generic Macros to Copy to the Right
As with the colouring macro, I have tried to make the copy to the right macro flexible. So, if you have the generic macro sheet open, and if you have a row of numbers somewhere, you can press SHIFT, CNTL, R and the numbers will copy to the right for as long as your row of numbers.
To see this, go to a blank sheet and press the number one somewhere near the top (for example in cell D4. Then press either ALT, E, I, S or ALT, or ALT, H, FI, S. (In French it is a bit more complicated). You will get a little menu like the following:
Then press the number 9 as the stop value and you will have a row of numbers. Just below the row of numbers (i.e. below the number 1), enter a few more numbers. I put in 100, 200 and then used the ALT, = short cut to add the numbers together as shown on the screenshot below.
Next, select the three numbers (the 100, 200 and 300) and press SHIFT, CNTL, R. The numbers should copy to the right as shown in the screenshot below. If this is not working, then you probably either do not have generic macros.xls open or the file is not enabled.
I have also tried to add an undo option to the Shift, CNLT, R macro which you can access with SHIFT, CNLT, S. Test the SHIFT,CNTL,S you can enter some other formula in the third row that currently contains 300. Then press SHIFT,CNTL,S. You should get the original number back.
You can also adjust the SHIFT, CNTL, R to look up to different rows and test other things. To adjust the generic macro file, you go to the first sheet of the file and change the parameters. After you change the parameters however you must run the implement macros macro.
If you want to put the SHIFT,CNTL, R macro in your workbook or in your personal workbook, I suggest copying the entire module where the macro is located in the generic macros.
Videos that Illustrate use of Generic Macros File
The first video below demonstrates how to use the Generic Macros file that you must download to colour your sheet efficiently.
The video below is long and about carrying charges, but I have used this video to introduce features of the Generic Macros file including screen colouring with CNTL,ALT,C and copying to the right with SHIFT,CNTL,R.
Miscellaneous Other Subroutines in Generic Macros
The generic macros file and a workbook named fm.xls includes a lot of different functions and macros. Some of the more important macros that create table of contents and remove the current sheet name from formulas and finds the links are shown below. As explained above, none of these macros have any irritating passwords and you can copy the macros into your files. The fm.xlsm file below has some of the older macros that I made a few years ago. The example calendar shows how you can create a macro that puts a password in a file and uses MATCH and INDEX over and over again with conditional formatting to make a calendar in excel (I doubt very much that you will use this).
Sub x_replace_sheet_name() Takes away current name of sheet in formulas
Sub x_Delete_cols() Deletes columns that are blank
Sub x_Delete_rows() Deletes rows that are blank
Sub x_fix_decimal() Fixes Problems with auto formatting
Sub x_find_rows() Finds number of rows in sheet
Sub x_find_cols() Finds number of cols in sheet
Sub x_colourTitles() Colours titles for the first column
Sub x_Create_Table_of_Contents_From_Sheet_Names() Creates Contents with links
Sub x_find_externl_links() Find External Links
Sub x_hide_sheets_after() Hide Sheets after Given Name
Functions in Generic Macros
In addition to macros, I put a bunch of user defined functions in the generic macros file. These macros do things like find the sheet name or the file name. They can also show who saved the file last and make a payback function. Unlinke the subroutine macros, you cannot just have the file open the functions. Instead, you must find the functions and then copy them into your file.
Function File_name() As Variant
Function MyUDF(LastSaved1 As Boolean) As Double
Function Last_save_by() As Variant
Function LastSaved() As String
Function lookup_NA(lookup_value, test_array, result_array)
Function match_adj(lookup_value, lookup_array)
Function dpayback(d_rate, series)
Function period_of_year(period, timing)