REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

We can use worksheet function in the VBA macros. We can call the worksheet functions using Application.WorksheetFunction. We can call any Worksheet function and use in our code. the below example will show you how to use the worksheet functions in VBA.

VBA to call Worksheet function

Here is the simple example to call the Excel worksheet function. We are uusing the ‘MAX’ worksheet function.

'VBA to call worksheet function
Sub sbVBA_to_call_worksheet_function()
    MsgBox Application.WorksheetFunction.Max (Range("A1:D20"))
End Sub

When you execute this example, this will find the maximum value in the range A1: D10.

VBA to call Worksheet function – Instructions

Please follow the below step by step instructions to test this Example VBA Macro codes:

  • Step 1: Open a New Excel workbook
  • Step 2: Press Alt+F11 – This will open the VBA Editor (alternatively, you can open it from Developer Tab in Excel Ribbon)
  • Step 3: Insert a code module from then insert menu of the VBE
  • Step 4: Copy the above code and paste in the code module which have inserted in the above step
  • Step 5: Enter some input values in Range A1 to D10 for teing the macro to call the worksheet function in VBA
  • Step 5: Now press F5 to execute the code or F8 to debug the Macro to check the if Range A1 is blank or not

There are many functions available in VBA, however, VBA functions alone are not enough to deal with our daily automation tasks. And it is waste of the time to write user defined function when there are Worksheet function available. You can use the Worksheet function and save lot of time. And make sure, you are passing the correct parameters while using the functions.

There are lot of functions like Vlookup, Hlookup, Index, Match, Offset are very useful while automating our tasks. You can simply call them using Application.WorksheetFunction and use it in your code. If you wan to write the userdefined function for Vlookup, you know how much time one should spend such a function. And they are faster than user defined funtion.

Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: VBATags: Last Updated: January 19, 2015

Leave A Comment