Excel Shortcuts Archives • https://www.thekeycuts.com/category/excel-shortcuts-2/ Learn Excel online with 100,000+ students Mon, 17 Jan 2022 23:37:24 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://i0.wp.com/www.thekeycuts.com/wp-content/uploads/2024/11/cropped-keycuts_newlogo-700X700.jpg?fit=32%2C32&ssl=1 Excel Shortcuts Archives • https://www.thekeycuts.com/category/excel-shortcuts-2/ 32 32 KeyCuts false episodic KeyCuts info@thekeycuts.com podcast Excel Shortcuts Archives • https://www.thekeycuts.com/wp-content/uploads/2019/03/dear_analyst_logo-1.png https://www.thekeycuts.com/excel-blog/ 50542147 Never Do Tedious Worksheet Tasks Again With Excel VBA https://www.thekeycuts.com/excel-vba-worksheet-tasks/ https://www.thekeycuts.com/excel-vba-worksheet-tasks/#comments Tue, 17 Jun 2014 18:01:20 +0000 https://www.thekeycuts.com/?p=2306 The moment you discover VBA in Excel, you will never want to do another formatting or data manipulation task in Excel. When we first discovered how to use VBA, it was like getting fed ground beef after you tasted filet mignon: you just can’t go back once you have tasted heaven. Many people think VBA is meant for programmers, and […]

The post Never Do Tedious Worksheet Tasks Again With Excel VBA appeared first on .

]]>
The moment you discover VBA in Excel, you will never want to do another formatting or data manipulation task in Excel. When we first discovered how to use VBA, it was like getting fed ground beef after you tasted filet mignon: you just can’t go back once you have tasted heaven. Many people think VBA is meant for programmers, and we can tell you that you don’t need to be a programmer to learn how to “code” in VBA. We are going to show actual VBA code in this post for one of the most common tasks we’ve found for using VBA: cycling through worksheets.

What you will feel like after learning the quick VBA tip in this post.

What you will feel like after learning the quick VBA tip in this post.

What is VBA?

Visual Basic for Applications is a programming language that allows you to do things in Microsoft applications like Excel, Word, and PowerPoint beyond the traditional user interface. You probably know where all the menus and buttons are in Excel, and hopefully you know keyboard shortcuts to get your job done even faster in Excel. There are times when you need to do repetitive, mundane, and frankly boring tasks in Excel like coloring a cell or doing the SUM() formula on some numbers. If you are doing the same tasks every single day to the same worksheets, you are probably a good candidate to implement VBA to save you from doing these repetitive tasks.

You may have heard of macros, which are the building blocks in VBA. Macros are step-by-step procedures written in Visual Basic that let you automate repetitive tasks. In order to get started with VBA, understanding the differences between objectsproperties, and methods is important.

A very basic example (pardon the pun) is a basketball. The basketball is our object. A property of the basketball, our object, could be its colors. The color can be black, white, but is typically orange. In terms of the basketball’s methods, these are actions the ball can take. For instance, the ball can bounce, roll, or maybe even pop. These are all different methods the object can do. The Microsoft Developer Network actually has a pretty good primer on getting started with VBA in Excel 2010. While that’s fun and dandy to read when you’re bored, we are all about doing and experimenting so let’s get right into the VBA code for helping you automate tasks you would do on many worksheets.

Cycle Through Worksheets VBA Code

Here is the bare bones code for quickly cycling through the worksheets in your workbook to apply some sort of operation on the cells in a given worksheet:

'Declare variables for the number of worksheets and sheet counter.
Dim numsheet, y As Integer
numsheet = application.Sheets.Count

'Cycle through sheets
For y = 1 To numsheet
  Sheets(y).Select

  'Here is where you would do a bunch of operations on your worksheet.

  range("A1").Select
Next y
Sheets(1).Select

It’s super simple and efficient. Line 9 is where you would enter in all the operations you would like to do on all the worksheets in your file. How does this simple script work?

We first need to figure out how many worksheets there are in your workbook, so we have a variable called numsheet that stores the number of worksheets in your file. application.Sheets is the object we are working on which essentially refers to the worksheets in your Excel file. Count is the method that we are applying to this object; the number returned is simply the number of worksheets.

In order to cycle through all the worksheets, we have to do a FOR/NEXT loop. This is where the For y = 1 To numsheet comes into play. The first time the loop runs, the variable y will equal 1. Therefore, Sheets(y).Select will be Sheets(1).Select the first time the loop runs. Sheets is the object and Select is the method we are applying to the Sheets object (which basically selects the current worksheet in your file).

range(“A1”).Select moves the cursor to cell A1 in each of your worksheets so that after you’re done applying operations to your worksheet, you’ll automatically be in cell A1 when you go back to that worksheet. Once the FOR/NEXT loop reaches the total number of worksheets in your file, it exits the loop and selects the first sheet (Sheets(1).Select) in case you have a lot of sheets in your file and want to be back in the first worksheet in your file.

Applying This Code To A Real File

Let’s say you have an Excel report where you need to make sure the first row is always highlighted yellow and bold since all your column headings are in the first row and you want your audience to notice those headings. Your Excel file has 10 worksheets that all have the same column headings. Of course, you could individually go to each worksheet and highlight the first row yellow and make the font bold, but this is the perfect task for our worksheet cycler code! So how do we make this:

excel VBA

Into this:

Excel VBA

You can download the sample file here to play around yourself, but here are the steps we would take to implement this code into a macro:

  1. Go to your Excel preferences and make sure the “Developer” tab is checked off so that it shows up in the Ribbon
  2. Click on Developer=>Editor
  3. Right-click on your file name in the project window and select Insert=>Module
  4. Copy and paste the code below in the next setion into the editor and hit Save
  5. Run the code by clicking on Developer=>Macros=>KeyCutsWorksheetCycler=>Run

VBA Code For Highlighting The First Row Yellow And Bold Font

In the first code sample, we left a section open for where you would enter in the operations you would want to apply to your worksheet. Here is what the code would look like for the specific case of highlighting the first row yellow and applying a bold font including the subroutine lines of code to make the macro work:

Sub KeyCutsWorksheetCycler()
' This macro cycles through all your worksheets and applies a yellow fill color and bold font to the first row.

'Declare variables for the number of worksheets and sheet counter.
Dim numsheet, y As Integer
numsheet = Application.Sheets.Count

'Cycle through sheets
For y = 1 To numsheet
  Sheets(y).Select
  Rows("1:1").Interior.ColorIndex = 6
  Rows("1:1").Font.Bold = True
  Range("A1").Select
Next y
Sheets(1).Select

End Sub

When you run the KeyCutsWorksheetCycler macro, Excel will cycle through all your worksheets and apply the yellow fill color and the bold font format. The actual “cycling” will happen so fast your eye may not catch it, but it’s indeed happening!

Apply A Bottom Border With Excel VBA

Let’s say you wanted to apply a bottom border to all the cells in the first row of every worksheet in your file. You would simply replace Lines 11 and 12 above with this code:

Rows("1:1").Borders(xlEdgeBottom).LineStyle = xlContinuous

The final code would look like this:

Sub KeyCutsWorksheetCycler()
' This macro cycles through all your worksheets and applies a bottom border to the first row.

'Declare variables for the number of worksheets and sheet counter.
Dim numsheet, y As Integer
numsheet = Application.Sheets.Count

'Cycle through sheets
For y = 1 To numsheet
  Sheets(y).Select
  Rows("1:1").Borders(xlEdgeBottom).LineStyle = xlContinuous
  Range("A1").Select
Next y
Sheets(1).Select

End Sub

Conclusion

After utilizing simple formatting macros like this, we quickly realized how much time we could save on or jobs and actually do interesting work we love. Understanding VBA is also a great skill set you can add to your resume, so take the first step in learning this simple tool and it will do wonders for your work and career!

The post Never Do Tedious Worksheet Tasks Again With Excel VBA appeared first on .

]]>
https://www.thekeycuts.com/excel-vba-worksheet-tasks/feed/ 1 2306
How You Can Save 40+ Hours From Your Life With Excel Keyboard Shortcuts https://www.thekeycuts.com/save-hours-life-excel-keyboard-shortcuts/ https://www.thekeycuts.com/save-hours-life-excel-keyboard-shortcuts/#comments Mon, 12 May 2014 11:00:35 +0000 https://www.thekeycuts.com/?p=2168 People often wonder how much time you can actually save using Excel keyboard shortcuts versus using the mouse. We ran a basic experiment and discovered that the average analyst can save 10.79 minutes a day using keyboard shortcuts instead of doing things manually with the mouse! This may not sound like a lot, but over the course […]

The post How You Can Save 40+ Hours From Your Life With Excel Keyboard Shortcuts appeared first on .

]]>
People often wonder how much time you can actually save using Excel keyboard shortcuts versus using the mouse. We ran a basic experiment and discovered that the average analyst can save 10.79 minutes a day using keyboard shortcuts instead of doing things manually with the mouse! This may not sound like a lot, but over the course of a year, this translates into 47 hours of time fiddling around with the mouse in Excel. Read below to see how we figured out Excel keyboard shortcuts make you 4.5X more productive. Thanks to Joe from Spreadsheets Made Easy for the experiment idea!

I waste 45 hours a year using the mouse in Excel?

You waste 47 hours a year using the mouse in Excel?

Setting Up The Experiment

We are testing how long it takes to complete 5 basic operations in Excel using keyboard shortcuts versus the mouse/trackpad. We think we should also see how long it would take to look up the Excel shortcut on Google but after doing this a few times times, but you have to open up your Internet browser, search for the shortcut, actually find the shortcut, etc. It takes way too much time so let’s just focus on the mouse vs. the keyboard. Note: all tests were done in Excel 2011 for the Mac.

The five operations we will test are:

Create Filter

This is creating the drop-down arrows on a basic data set as shown below.

Create Filter

Fill Formula Down

This operation involves creating a formula on a fly across a range of cells. In this case, we want the empty cells in the third column to be a product of the first column times the second column. We already have the first cell done ($12.99 X 10%), so we need a way to copy that formula down to the remaining cells.

Fill Formula Down

Apply Percentage Format

We have a number like .453 and we want to convert this number to be a percentage format: 45%.

Delete Column

Pretty self-explanatory, we want to delete an entire column from our worksheet.

Paste Special

Let’s bring up the Paste Special menu which you all have seen before:

Excel Paste Special

Experiment Results: Keyboard Shortcuts Rock!

Excel keybaord shortcuts experiment results

In order to figure out how much time Excel keyboard shortcuts would actually save you on the job, we created some basic assumptions about how many times you would use these common Excel operations every day at work and how many days you work per year. The results show that you would be 4.5X more productive, or save 80%+ time using Excel keyboard shortcuts instead of the mouse.

Excel keyboard shortcuts time saved from experiment

Increased Productivity Means Money

This was a simple experiment that could be improved with a more controlled environment, but the results are pretty clear. The team over at Exceljet put together a similar analysis looking at the dollar value from improving a skill (such as Excel). If we take our analysis one step further, we can figure out how much money you would save learning Excel keyboard shortcuts. Let’s put in a few assumptions about an entry-level analyst.

  • An entry-level analyst earns let’s say $55,000 USD per year
  • This means the analyst earns $26.44/hour (assuming 260 working days/year at 8 hours/day)
  • You would save $1,237 per year by using Excel keyboard shortcuts

This is just an example for one employee who has an entry-level salary of $55K. Imagine how much more productive a company would be if ALL there employees saved 47 hours per year on doing simple Excel tasks at different levels in the company. Excel keyboard shortcuts are not just for analysts, but also for managers, C-level executives, and anyone who touches a spreadsheet.

Ways To Increase Excel Productivity

Most people who want to learn to use Excel better will search on Google when they come across an issue. This is definitely a great way to learn new Excel formulas and tips, but learning keyboard shortcuts cannot involve Googling a shortcut every time. The few times we tried Googling a shortcut, the average time was 15 seconds!

Learning keyboard shortcuts by looking at a cheat sheet is a slightly better improvement, but still requires you to scan a list to see which shortcut you are looking for. You all know about our Excel keyboard covers, and we believe that showing the shortcuts literally at your fingertips should help you memorize the shortcuts you need the most for your job!

Our online classes with Skillshare should also help you with getting more proficient in Excel, here are the links to the classes again:

The post How You Can Save 40+ Hours From Your Life With Excel Keyboard Shortcuts appeared first on .

]]>
https://www.thekeycuts.com/save-hours-life-excel-keyboard-shortcuts/feed/ 6 2168
Top 5 Excel Shortcuts for the Mac https://www.thekeycuts.com/top-5-excel-shortcuts-mac/ https://www.thekeycuts.com/top-5-excel-shortcuts-mac/#comments Tue, 29 Oct 2013 15:14:21 +0000 https://www.thekeycuts.com/?p=1350 Many of you are transitioning to Excel for the Mac, and have asked us what our favorite Excel Mac shortcuts are. While our keyboard covers show the 20 most commonly used shortcuts, there are definitely a few gems that really make using Excel on the Mac that much better than the PC. That’s right…I said it…Excel […]

The post Top 5 Excel Shortcuts for the Mac appeared first on .

]]>
Many of you are transitioning to Excel for the Mac, and have asked us what our favorite Excel Mac shortcuts are. While our keyboard covers show the 20 most commonly used shortcuts, there are definitely a few gems that really make using Excel on the Mac that much better than the PC. That’s right…I said it…Excel for the Mac is better than the PC!

excel_better_mac

Here are the Top 5:

1) Autosum a Bunch of Numbers – SHIFT+COMMAND+T

autosum

We’ve all had to type =SUM(blah blah blah) before to sum a bunch of numbers. This handy shortcut let’s you create the sum automatically without having to type in the formula! Just go to the empty cell below a bunch of numbers you want to sum and hit shift+command+t and Excel automatically knows which cells you want to sum!

2) Increase/Decrease Font Size – SHIFT+COMMAND+. (increase) SHIFT+COMMAND+, (decrease)

font_size

The reason why this is the best Mac Excel shortcut is because it doesn’t even exist on the PC! Quickly increase and decrease the font size without going through the Format Cells menu or clicking on the pesky font size drop-down in the toolbar.

3) Delete Everything in Selected Cells – FN+DELETE

delete

Why is it so hard to delete stuff in Excel for the Mac? Press fn+delete and you’ll actually delete everything in your selection and the delete button actually works like it’s intended to work.

4) Create Filter – SHIFT+COMMAND+F

filter

You have a list of data and you need to create a filter. Instead of going through the regular toolbar, navigate to the first row with the field names in your list and hit shift+command+f. Simple.

5) Center Align Data – COMMAND+E

center

You have a bunch of cells with data and they are all weirdly aligned. Some are right-aligned and some are left-aligned. The reason why this shortcut is so powerful is because it’s SO EASY to use! There is no equivalent on the PC; the PC shortcut is ALT, H, A, C! Definitely a lot simpler to hit command+e in my opinion!

In conclusion, Excel for the Mac is pretty powerful…

Which Excel for Mac shortcuts do you use every day? Which Excel shortcuts on the PC do you wish existed on the Mac?

dwight

The post Top 5 Excel Shortcuts for the Mac appeared first on .

]]>
https://www.thekeycuts.com/top-5-excel-shortcuts-mac/feed/ 5 1350