VBA to Clear a Filter
Using Excel’s built-in filtering can speed up your VBA code.
It is important if you are applying filters that you clear any existing filters before you apply a new filter. Otherwise the existing filters will usually affect a new filter you apply.
The line of code below will remove filters on Sheet1 (Sheet1 is the sheet code name that you see on the left side of the VBA screen – it may not be the sheet tab name).
If Sheet1.FilterMode Then Sheet1.ShowAllData
The .FilterMode property is True if a filter is in place on the sheet and False if not.
The .ShowAllData method will return an error if no filter is in place – hence the use of the If statement.
An Avo Chart
I wonder if we can get one of these on Power BI?
Saw this on the website below and liked it – I also like Avocados.
Avocado article on the ABC site
We must always change, renew, rejuvenate ourselves; otherwise we harden.
Johann von Goethe (1749 – 1832)
Instant Format in Excel
You may know the two keyboard shortcuts below for currency and percentage.
But what you may NOT know is a technique that has been around since the early versions of Excel.
The technique allows you to automatically apply these two formats after you type an entry.
It you type $1000 into a cell and press Enter. Excel will automatically apply the $ format to the cell. The $ sign will not display in the Formula Bar – see below.
If you type 2.5% into a cell. Excel will automatically apply the standard % format to the cell. The % sign will display in the Formula Bar – see below.
As I mentioned these are really old skills that have been lost over the years since we no longer have Excel manuals – shows my age.
Here’s the problem, we have four separate tables with the same layout. They hold four different metrics: Actuals, Budget, Forecast and Last Year. A column called Type is used to hold the metric name. We need to populate the Type column.
Disclaimer: I received a free copy of this book to review.
This book is a great introduction to Financial Modeling.
The content is easy to follow and gets you started on the right foot with lots of best practice advice.
The only downside of the book is the screen shots tend to include the whole screen rather than zoom in on the important part of the screen – many images are hard to read.
The book is a great primer for Danielle’s first book
which allows you to learn even more about financial modeling.
It takes less time to do a thing right than if does to explain why you did it wrong.
Henry Wadsworth Longfellow (1807 – 1882)
When you copy a sheet that contains range names you usually end up making a duplicate of those names at the Worksheet level. I have written a macro that removes all duplicated sheet-based range names in a file.
Of all the liars in the world, sometimes the worst are your own fears.
Rudyard Kipling (1865 – 1936)
Correction does much but encouragement does more.
Johann von Goethe (1749 – 1832)
My consulting work recently highlighted a stark contrast in different Excel models and the effort it takes to create or change them. I make some recommendations to make things easier for yourself at the end of this post.
The secret of joy in work is contained in one word – excellence. To know how to do something well is to enjoy it.
Pearl S. Buck (1892 – 1972)
Top 5 Books
A recent email from CPA Australia listed my Excel book (Advanced Excel Reporting for Management Accountants) in the top 5 of all books – see list below.
Members of CPA Australia can access electronic books for FREE via ProQuest – links are below.
You will need to log in to the CPA Australia site to be able to access them.
Range Selection Tip and Trick
You know how when you press Enter you usually select the cell below? You can override that without changing a single setting.
When you select a range Excel can behave differently when you press the Enter key. Not many users know this trick.
Select the range B2:G2 in a blank sheet and press Enter. The cell selected will be the one on the right or back at the start of the range depending which cell was active when the range was selected.
Pressing Enter cycles through all the cells in the range.
This works for two dimensional ranges as well – in that case the cell below is selected until the bottom of the range is reached then the top of the next column within the range is selected.
This is handy for entering data into input ranges.
Let’s say range A2:D2 has basic links referencing the cell above so cell A2 has =A1 in it.
What if you wanted to change all those relative references to fixed references?
Select the range A2:D2 and then press these three keys in sequence
F2 F4 Enter
Repeat three times – job done!
F2 is the Edit command.
F4 converts a relative reference into a fixed reference.
Enter accepts the change.
You can often achieve very fast changes with keyboard techniques like this.
For example if a cell contains an email address or a web address but it isn’t recognised as a link, simply select the cell and press F2 then press Enter to convert it into a link.
If there is a column of them, just keeping pressing F2 and Enter to convert them all. You can become quite fast.
Sometimes Excel surprises me. In this case it sorts in a way I didn’t expect, but in a good way. Thanks to Mr Excel for the tip.