Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
VBA could be part of a strategy that uses the best of your technology:
– use your HRIS and other systems for their core functions
– use the powerful functionality of Excel and VBA to give you all the good stuff
We will discuss
1. The business case
2. An alternative technology strategy, using Excel and VBA
3. A model of a salary planning tool
4. Specific examples of VBA code used to automate some functions in this tool
While we only have an hour and this is by no means a complete discussion of VBA, it will
present a starting point to solutions you may not have know existed. Part 2 – date not yet
scheduled – will focus on the development of a GUI in Excel
2
HR Value What We Do
We help companies with custom solutions in two key areas:
• Business Analytics and Information management
• Automation of time intensive processes
We take the most complex process and give clients “click of the mouse” ease, all
at a cost that is a fraction of system modifications or additional software. Excel
and VBA allows construction of sophisticated business tools - a pre/post
information processor for business data, or the ability to create sophisticated
‘turn-key’ solutions that rival and exceed million dollar alternatives.
You can easily access data from multiple systems, HRIS, payroll or outsourced
solutions, and refresh that data at any time. You can access even the most
complex analysis, reports and charts. All with tools that are sitting- largely
underutilized - on their desktops.
We add value, and save our clients time and money
This is not a sales pitch. We want to introduce you to an Excel you may
not know exists, by using some very specific examples. We provide help in
3
these areas, but everything discussed here is available on your desktop.
Administrative and compliance activities
dominate HRIS systems and dollars
Edward E. Lawler III, The HR Department: Give It More Respect, MIT Sloan Management
Review, Posted March 10, 2008 http://sloanreview.mit.edu/wsj/insight/hr/2008/03/10/
4
How do you break the cycle?
The good Dr. Lawler never quite explains how the
HR staff “spend less time processing benefits
requests and more time being the expert
resource on the state of the organization's work
force and its ability to perform” but his perception
is spot on – HR is caught in a death spiral of
compliance and administration.
The question remains – WHY?
Edward E. Lawler III, The HR Department: Give It More Respect, MIT Sloan Management
Review, Posted March 10, 2008 http://sloanreview.mit.edu/wsj/insight/hr/2008/03/10/
5
HR Value Point of View
• Core HR technology solutions are built to address the very important
compliance and administration tasks of their profession, largely driven by
Payroll, Benefits, and record keeping. It is very difficult to develop robust
planning tools or administer multiple approaches with a payroll system
• Even when using 'The Best’ software, you are tied to the capabilities and
functionality of your HRIS system that often delivers a rigid and plain vanilla
process. This is not what leadership wants
• There is no competitive advantage in doing things just like the competition
• Add-on packages claim to solve your problems, but you soon discover you
simply trade one set of limitations for another, or create information silos
that restrict meaningful analysis - all at a considerable expense
• And there is little interest in spending more money on expensive systems or
system modifications that cannot demonstrate a positive ROI
6
Compensation Decision Making
Market
Pay
Ongoing program management, Salary and incentive ratios that
performance evaluation, and reflect the business role and
planning. competitive environment.
Market-based objectives, set to enable Objectives Measures & Performance metrics and weights
value-adding organization performance. &Goals Priorities that clearly communicate business
priorities.
9
C-Suite credibility requires the ability to
model pay and performance options
quickly and clearly for a busy, non-
specialist audience.
software solutions
without limits at a
fraction of the cost of
Now, imagine… alternatives
Relational
Pensions
401k
PORTAL
Internal
External
It doesn’t have to be this complicated
Data Excel and other Microsoft Excel and VBA provide
Sources Office products utilize a the capability to rapidly
programming language called integrate information
HRIS
Visual Basic for from different
Applications or VBA. applications, without a
Sales
Stock
Excel and VBA integration costly infrastructure.
Options
features come pre-built, so
using Excel as an information
T &&DD
T integration platform avoids
the time and cost of
Finance
developing applications from
scratch that perform the Unfortunately, many
Pensions
same
VBA construction of sophisticatedofbusiness
tasks.
allows Excel's features
tools are
401k • a pre/post information processor forstill largelydata
business unknown
• automation of time intensive tasks or dismissed
Internal prematurely
External 12
Excel comes standard with tools that
can provide sophisticated task support
Information analysis, organization and
Excel to the rescue!
processing
Microsoft Excel fills the niche of being
able to perform complex business Report and form generation
analysis tasks or automate business Creating and combining planning tools
tasks rapidly and cost effectively
Import and combine data from multiple
Excel with VBA is one of the most databases
powerful, flexible packages on the
market today Integrate information from different
applications
Excel has tremendous capabilities that
can help streamline your business Charting and Modeling
tasks Budgeting and Planning
Unfortunately, many of Excel's “What if” scenarios
features are still largely unknown or
dismissed prematurely Accruals
14
1. GUI Design –
Intuitive Graphic Interfaces
15
2. Workflow managed by Menu functions, tailored
to your requirements– no compromises
“Click of the Mouse” ease
16
3. Workflow creates a “foolproof” process
17
4. “Non-Technical” users can update tables,
without IT or “power user” intervention
18
VBA allows construction of
sophisticated business tools in Excel
Need to understand:
The basic principles of the VBA
language.
The concept of a VBA project.
The concept of a VBA procedure.
How to manage and use VBA
modules that store VBA code
The operation of the VBA Editor
You can then add parameters. “Kick the Soccer ball hard, high, and to the left”
• You add the elements to a VBA project when you need them.
21
VBA Procedure
22
VBA Modules
They store and organize procedures that are used to perform tasks like
controlling Excel, communicating with databases, calculating equations…etc.
If you want to receive the excel files with these examples, please complete the
feedback form and indicate so. Include your name and email address.
23
VBA Editor
VBA projects are created, edited and debugged in the VBA Editor.
The VBA Editor is activated from the Excel ribbon and selecting Developer
then Visual Basic.
You can toggle between Excel and VBA by pressing Alt + F11
24
VBA Editor window contains many
windows that can be displayed at once.
25
VBA comes standard with a set of
built-in debugging tools
A designer uses these tools in a detective role, stepping through a procedure’s code line
by line executing them, viewing their results and detecting mistakes along the way.
The following list presents the code error types that are encountered when developing
procedures:
Language . Language errors result when statements are constructed incorrectly. Some
common language errors are:
• Improper use of parenthesis
• Forgetting to type an End or Next keyword
• Misspelling a keyword
VBA will detect these errors before the code is executed. They are caught during the
compilation phase or typing phase (indicated by red syntax).
Run-time errors. Run-time errors occur when a statement attempts an impossible
operation. Some common run time errors include identifying objects that do not exist or
dividing in an expression by 0. VBA detects these errors during code execution.
Logical errors. Logical errors occur when an executing procedure does not do what it is
supposed to do. The syntax is correct and performs operations, just not the expected
ones. Errors of this nature cannot be easily detected by just executing the code.
26
VBA comes with tools to speed your
work – IntelliSense
27
VBA Code Examples
VBA allows to build powerful and sophisticated applications that rival stand alone
applications costing hundreds of thousands or millions of dollars.
We will show you a stand alone salary planning tool, and show you some of the
VBA code that makes all of it possible. These functions could be part of a library
that could be included in spreadsheets for efficiencies, or part of a turnkey solution.
• Disable Cut/Copy/Paste
• Add a sort button
• Import file
• Loop
• Color rows
If you want to receive the excel files with these examples, please complete the feedback
form and indicate so. Be sure to include your name and email address.
28
Example : Salary Planning to your exact
specifications
29
Break to live example of tool
30
Salary Tool - Automated with VBA
Disable Cut/Copy/Paste
To prevent managers from ‘messing up’
the Data, we disable certain dangerous
Functionality. They ‘click the mouse’
for a flawless workflow
Import files
Multiple files can be imported Loop
with a click of the mouse to Looping is not available in the Macro Recorder,
refresh the data any time But is necessary for repetitive functions, such as:
- Creating Multiple planning tools
- Parsing Data
- Combining completed tools
In this case
since the sheet
we are coloring
has 25 rows
filled in in
column A.
FinalRow takes
the value of 25.
VBA code for ColorRowsModule explained
If we run the code again now that “C3” is set to “0.” The first if statement
is false so the code after the else statement is executed. This results in
a similar output except the sort order is descending so it will sort from
Largest to Smallest.
Too good to be true?
Questions and Discussion
If you want to receive the excel files with
these examples, please complete the
feedback form and indicate so. Be sure to
include your name and email address.
HR Value, LLC Or send an email directly to
Delivering exceptional results
with the click of a mouse royfarrell@4hrv.com
Roy Farrell
RoyFarrell@4hrv.com
www.4hrv.com
(614) 266-5926
44