Вы находитесь на странице: 1из 15

5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Advanced Excel Tips & Tricks

Advanced Excel Tips Excel News Excel Shortcuts Excel Tips Games

Learn Excel Learn Excel VBA Tips

VBA Tips \ Raghu R  14281 3


Search

 5 must-know Excel macros


Recent Posts
for common tasks
1. Excel VBA – Convert
Numbers to Words in
Hindi Language

2. How to VLOOKUP to
If you’re not using macros, you’re ignoring one of
get Cell Color and
Excel’s most powerful features. Macros save you time
Font Color along with
and spare you headaches by automating common, Lookup Value
repetitive tasks. And you don’t have to be a
programmer or know Visual Basic Applications (VBA) 3. How to Calculate
to write one. With Excel 2013, it’s as simple as Estimated Travel
Time in Excel?
recording your keystrokes.
4. How to Show Full
Here we’ll show you how to create macros for ve
Path in Excel Title
commonly performed functions.
Bar?

Macro Basics 5. How to Highline


Excel 2016 Class 21:
To record a macro, click Record Macro under the
Power Query Import
Developer tab. In the Record Macro dialog box, enter Multiple Excel
the following information and click OK when you’re Workbooks with 
done. Multiple Sheets

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 1/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Macro Name —the rst character must be a letter, 6. How to Highline


followed by your choice of letters, numbers, or an Excel 2016 Class 22:
underscore. No other characters are accepted. How To Build Data
Model & DAX
Formulas in Power
Pivot

7. How to Excel Magic


Trick 1330: Append
All Excel Tables in
Current Workbook:
Shortcut Key —CTRL+J and CTRL+M are available. If Power Query (Get &
you choose any other character, your macro will Transform)

overwrite that key’s original function. 8. How to Step by Step


Instructions for Easy
Save location —Macros saved in “This Workbook” or
EXCEL Dashboards
“New Workbook” function only in those workbooks. To
use in all spreadsheets, save macros to the Personal 9. How to Excel Magic
Macro Workbook (PMW). Trick 1331: Import
Multiple Excel Files &
Description —Describe the macro. Sheets into Excel:
Power Query Get &
Transform

10. How to Making an


Excel Dashboard –
Tutorial #1 Copying
Widgets

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 2/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Name, save, and de ne your macro.

Because macros perform repetitive tasks, the object


is to use them on a lot of different spreadsheets. This
means you cannot hard-code the cell addresses (C1,
D5, etc.), unless all of the spreadsheets are identical,
which means the same number of records in the
same columns and rows. To make the macro work on
all spreadsheets with similar data, you must use the
directional keys to navigate—then, the number of
records won’t matter—and always begin at the A1
position.

Organize, format, and sort


imported data
Data from other programs is often available in TSV or
CSV les (Tab- or Comma-Separated Values). Imagine
receiving two dozen of these les every month, which
have to be organized, unwanted data removed, and
then sorted by company name. It takes hours to do a
report like that. This macro does it in seconds.

Open the CSV worksheet. Follow the directions above


to name, de ne and save your macro, then record the
keystrokes below.

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 3/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

1. Press CTRL+Home to reposition your cursor in cell


A1. Hold down the CTRL key and click the letters over
the columns you want to eliminate (B through N plus
R). Select Home>Delete>Sheet Columns.

What a mess. First delete unwanted columns.

2. Hold down the CTRL key and click columns A and


D. Select Home>Format>Column Width>42>OK. Hold
down the CTRL key and click columns B and C. Select
tabHome>Format>Column Width>25>OK.

3. Press CTRL+Home, then CTRL+A (to select all data


in the spreadsheet).

Select Home>Sort & Filter>Custom Sort. In the Sort


dialog box under Column, chooseName. Under Sort
On, choose Values, and under Order, choose A-Z.

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 4/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Sort by company name.

4. Select Developer>Stop Recording, and it’s nished.


Save the worksheet as an Excel le. Open the CSV le
again, select Developer>Macros, select the
BranchCSV macro from the list, and click Run. The
entire worksheet is organized in one second.

Open the CSV le again and run the macro.

Split names from one column


into two
How many times have you received a long list of 
names in one column you needed split into two

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 5/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

columns, so the rst and last name are separated?


This macro does it in seconds plus sorts the list,
adjusts the column widths, and gives a total list count.
Open the Names worksheet, name and de ne your
macro, then record these keystrokes.

1. Press CTRL+Home, CTRL+A. Select Data>Text to


Columns. In the rst Wizard dialog box, click
Delimited>Next. In the second box, choose the
character that delimits (separates) your text. Our list is
separated by spaces, so check Space>Next. In the last
box, click Text>Finish.

Choose Text to Column to separate rst and last


names.

2. Press CTRL+Home, then CTRL+A. Select


Home>Sort & Filter>Custom Sort. In the Sort dialog,
select column B in the Sort By eld. Click Add Level,

then select column A in the Then By eld. For Sort On

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 6/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

and Order, leave the defaults Values and A-Z, then


click OK.

Sort two levels, last name, then rst name.

3. Press CTRL+Home. Press Shift-Right-Arrow to


highlight A1 thru B1. ClickFormat>Column
Width>15>OK.

4. Press CTRL+Home. Select Home>Insert Sheet


Rows, twice. In A1, type Total Names . Use the right
arrow key to navigate to B1, then enter this
formula: =COUNTA(  and press CTRL+Down-
Arrow, End, Shift-Down-Arrow, Enter, CTRL+Home.
The total appears in B1.

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 7/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Enter the formula to count the names in the list, then


run the macro.

5. Stop Recording, save the worksheet as Names2.


Open the Names le again and run the macro.

Split column and adjust for


middle names
In Excel 2013, it’s easy to divide one column of names
into two columns, but what if half the list contains
middle names/initials and half does not? This macro
extracts the middle names/initials entries, rejoins
them with the rst names, then produces one list with
rst/middle name in rst column and last name in

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 8/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

second column. Open a three-names le, name and


de ne your macro, then record these keystrokes.

1. Press CTRL+Home, CTRL+A. Select Data>Text to


Columns. In the Wizard boxes, click Delimited>Next,
Space>Next, and Text >Finish. One column becomes
three.

2. Press CTRL+Home, CTRL+A. Select Home>Sort &


Filter>Custom Sort>column C. Press Shift-Right-
Arrow. Click Format>Column Width>15>OK.

3. Press CTRL+Home, Right Arrow twice. Press End


once, Down-Arrow twice, Right Arrow once—this
moves the cursor to the rst empty cell in column C,
then to the adjacent cell in column D. Type: STOP ,
press Up Arrow, End, Up Arrow. Type this formula:
=A1&” “&B1 , then press Enter, Up Arrow.

Use directional keys to navigate so the macro works 


on all similar worksheets.
https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 9/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

4. Press CTRL+C, Down-Arrow. Hold down Shift, then


press End, Down Arrow, Up Arrow, Enter (copies
formula). Press Up Arrow once, hold down Shift, press
End, Down Arrow, Up Arrow (this highlights the range
without STOP).

5. Press CTRL+C, CTRL+Home, select Paste>Paste


Special>Values>OK. PressEscape, CTRL+Home, Right
Arrow twice. Hold down Shift, press End, Down Arrow,
CTRL+C, Left Arrow, Enter to copy last names. Press
Right Arrow, Shift-Right-Arrow.

Copy and paste the formula, then remove extra


columns.

6. Select Delete>Delete Sheet Columns. Press


CTRL+Home. Stop Recording, save the worksheet as
3Names2; open 3Names again and run the macro.

Repetitive Text

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 10/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

If you’re typing the same information 10 times a day,


you’re begging for a macro. Even if that information is
brief, a macro does it in seconds and ensures
accuracy. This macro adds your company info to the
top of a worksheet and inserts the current date. Open
a new worksheet, name and de ne your macro, then
record these keystrokes.

1. Press CTRL+Home. Hold down Shift, then Right


Arrow twice. Select Home. From the Alignment group,
select Merge Across. Enter this formula in cell A1:
=TODAY() Enter, Up Arrow. Select
Home>Format>Format Cells>Date. Choose a date
format from the list, click OK. Press Down Arrow
twice.

2. Type the repetitive information and press Enter at


the end of each line. Press Down Arrow. Select
Developer>Stop Recording. Delete it all, unmerge cells
A1 through A3, then run the macro. Save the
worksheet.

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 11/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Create a header macro with the current date to


eliminate repetitive typing.

Remove Blank Rows


A worksheet lled with blank rows is impossible to
manage, sort, or calculate. The rst step is to instruct
the macro to highlight the spreadsheet data only, then
select and remove the blank rows. Once that’s
accomplished, you can easily manage the data.

Open a le with blank rows, name and de ne your


macro, then record these keystrokes.

1. Press CTRL+Home. Note: CTRL+A will not select all


the data when blank rows are in the spreadsheet, but
this macro will.

2. Select Home>Insert>Sheet Column. Press End,


Down Arrow, Right Arrow, End, Up Arrow. Press
CTRL+Shift-Home, Shift-Right-Arrow, CTRL+Shift-

Right-Arrow. And the data range is properly selected.

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 12/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

Remove blank rows.

3. Select Home>Find & Select>GoTo Special (or press


CTRL+G, ALT+S). ClickBlanks>OK and all the blanks
highlight in gray. Select Delete>Delete Cells>Shift Cells
Up>OK and the blanks vanish. Press CTRL+home,
then select Delete>Delete Sheet Column to remove
the extra column we inserted to highlight the
spreadsheet without hardcoding cell addresses.

4. Stop Recording. Undo all steps, then run the macro.


Save the worksheet.

Courtesy: PC World

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 13/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

About The Author


Raghu R

Excel is my Passion and VBA Love of Life. I like to solve and automate any
possible opportunity in Excel including in combination with O ce Applications
(Access, Outlook, Word, PowerPoint, Visio, etc) and other Non-O ce Applications
(SAP, IE, Batch, Con guration Management Tools, etc). Note: All the solutions
given here are published after thoroughly tested to my knowledge, however it is
advised to keep a copy before you try it.

Related Posts

 Learn to Plot A “XYScatter Chart” on Fly : VBA Macro Code

 How to create a dynamic chart

 24 Excel Keyboard Shortcuts to Help You Work Faster, Better

 Learn to use HLookup in Excel

 Excel Count Functions 

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 14/15
5/29/2019 5 must-know Excel macros for common tasks – Advanced Excel Tips & Tricks

 Excel Tip : How to Generate Unique Usernames using the IF() and COUNTIF() Functio

 Do you know there is a Calculator in Excel?

 How to Download/Extract Product Details from eBay Shopping Website in Excel

 10 Tricks to Make Data Entry Easier in Microsoft Excel

 Excel 2013: New Tools for the Everyday User

 Excel Tips / Learn Excel / VBA Macros

Show Comments 

Advanced Excel Tips & Tricks Copyright © 2019.  

https://quadexcel.com/5-must-know-excel-macros-for-common-tasks/ 15/15

Вам также может понравиться