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 we are doing anything with one are more values is called an operation or task. To perform any operation we required minimum one symbol and one Variable or Value. The symbol is called an Operator and the Variable or Value is called an Operand.In this tutorial we will learn more about Operators and Operands in Excel VBA.

Operators and Operands in Excel VBA – The Assignment Operator:

If it is a numeric variable the computer will initiate 0 by default, if it is a string it will initiate an empty space. You can initiate your own value to variable by using assignment operator ‘=

Example:


Sub sbExampleAssignmentOperator()

'Variable Declaration
    Dim intRank As Integer

'Initiating
    intRank = 500
'Here = is called as an assignment operator,
'it will assign the value 500 into intRank

'Showing
    MsgBox intRank
'If you check the variable now,
'you can see the 500 is assigned to that.

End Sub

The Line Continuation Operator: _

You can use space + underscore to split a single statement into more than one line

Sub sbExampleLineConnector()

'Variable Declaration
    Dim intRank As Integer

'Initiating
    intRank = _
    500
'We have splitted a single line into
'two by using space+underscore

'Showing
    MsgBox intRank

End Sub
The Double Quotes: “”

You can use “” to delimit a group of characters and symbols.

The Colon Operator: :

You can use : to put the two statements in a sing line.

String Concatenation: &

It is used to concatenate tow strings.

Carriage Return-Line Feed: vbCrLf

It will create new line. If you want to display a message to the user in two line instead of on single line, you can use this.

Operators and Operands in Excel VBA – Arithmetic Operators
Arithmetic Operation Operator
Addition: To add add one value to another +
Subtraction: To subtract one value from another
Multiplication: To multiply one value with another *
Integer Division: Divide one number with another and the result will be an integer
Decimal Division: Divide one number with another and the result will be an integer /
Exponentiation: To get the one power value with another ^
Remainder: To get the division remainder Mod
Operators and Operands in Excel VBA – Logical Operators
Logical Operation Operator
Equals to =
Greater than >
Greater than or Equals to >=
Less than <
Less than or Equals to <=
Not Equals to <> or !=
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: Excel VBATags: Last Updated: June 17, 2022

3 Comments

  1. Changwon March 28, 2014 at 11:40 AM

    Hi,
    Really appreciate your hard work.
    Found a tiny typo.
    MagBox intRank

    Thanks.
    Changwon.

  2. PNRao March 29, 2014 at 11:02 AM

    Hi Changwon,
    Thanks for finding a type, corrected now!

    Thanks-PNRao!

  3. Endalamaw December 6, 2015 at 10:44 PM

    Hi dears,
    I appreciate you. Its a good job.
    Thanks for your great work.
    I am an accountant. I want to learn excel VBA as a beginner. how can I be a good programmer ?
    Thank you in advance!!!

Leave A Comment