Vba introduction

SandeshSingh17 3,829 views 24 slides Nov 06, 2019
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

VB


Slide Content

VBA Introduction

Excel VBA is the coding language of Excel. VBA stands for Visual Basic for Applications and is actually Microsoft’s general programming language for all Office Applications What is VBA

Objects in VBA Macros

This course concentrates on you writing VB Code. You will learn to create Automations In Excel For Example; How to get Data from multiple Excel files and make a single file our of them, by a click of a Button. Macro Recording Complete Complex task Reusable Code Speed Work What will you Learn

MsgBox

Comments

InputBox

Assign a macro to a Button Select the macro name Click on OK Button Invoking a procedure

Remarks: Turn screen updating off to speed up your macro code. You won't be able to see what the macro is doing, but it will run faster. Remember to set the Screen Updating property back to True when your macro ends. Application.screenUpdating

User - Defined Functions(UDFs)

Just like a built-in function, a UDF is a pre-defined formula which can be executed in the same way. The difference is that you design the definition using VBA. In this way you can define functions which do not exist as built-in functions, but which you may need to use frequently. What is a UDF?

You use a UDF for the same reason as a built-in function, namely to make calculations (operations) which are repeated more efficiently. Before writing a UDF make sure that it does not already exist as built-in Excel function! When and why do you use a UDF?

Function name [(arguments) [ As type] ] [ As type] [statements] name= expression [ End Function ] User Defined Function Syntax:

Function multi2num(x As Integer,y As Integer) As Integer Multi2num = x + y End Function Example :

Write a Function to check whether the number is Even or Odd. Write a function for number between 1-17 should return “young”, 18-40 should return “middle age” and above will be Senior Citizen. Write a Function for Cube of a Number Exercise

Calling a Procedure in Some other Pocedure

VBA Arrays

Remove Duplicates

Error Handling

Example

Example

Events
Tags