Operators and Operands in Excel VBA

Home/Excel VBA/Operators and Operands in Excel VBA

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.



50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates

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 ‘=


Sub sbExampleAssignmentOperator()
'Variable Declaration
Dim intRank As Integer
intRank = 500
'Here = is called as an assignment operator,
'it will assign the value 500 into intRank
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
intRank = _
'We have splitted a single line into
'two by using space+underscore
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 !=
By |July 21st, 2013|Excel VBA|3 Comments

About the Author:

PNRao is a passionate business analyst and having close to 10 years of experience in Data Mining, Data Analysis and Application Development. This blog is his passion to learn new skills and share his knowledge to make you expertise in Data Analysis (Excel, VBA, SQL, SAS, Statistical Methods, Market Research Methodologies and Data Analysis Techniques).


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

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


    • PNRao March 29, 2014 at 11:02 AM - Reply

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


  2. Endalamaw December 6, 2015 at 10:44 PM - Reply

    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

Related pages

excel formulas valuesumif formulas in excelvb recordsetexcel delete named rangedashboard excel tutorialiferror excel functionexcel fixed column widthdata analyst interview questions and answers for freshersexcel macro protect sheetprotecting excel workbookforgot excel password to unprotect sheetmacro excel exampledefine macros in excelvba code timerexcel vba additemmacro to delete rowshow to multiple columns in excelexcel password cracker macroexcel vba lengthvba forms in excelhidden numbers worksheetvba programming for beginnersexcel vba application.matchselect case in vbasumifs vbaexit sub vbasql objective type questions and answers pdfsheet activate vbawhat are dml and ddl commands in sql serverworking with pivot tables in excel 2007designing dashboards in excelinterview worksheetsms access vba code examplesvba upper casevba function subvba delete worksheethow to call a subroutine in vbavba to remove duplicatesexcel vba open files in folderdeveloper tab excel 2007excel shortcuts insert rowexcel vba listboxmsgbox vbyesnoaccess vba close formvba crlfhow to connect cells in excelhow to record macros in excelddl language in sqlexcel duplicate cellcheckbox in excel vbacol_index_numshow developer tab in excel 2007how can i merge two columns in excelfiltering duplicates in excelexcel vba chr functionmacros tutorialsdeveloper tab excel 2007excel select empty rowsactive worksheet vbaproject planner excel templatehow do i find duplicates in exceltracking sheet excel templaterecordset excel vbaproject deliverables template excelusing vbadynamic cell reference excelhow to insert hyperlinks in excelhow to put a checkbox in excelhyperlink in vbamacro delete blank rowsrange excel vbaoffset excel examplehow can use pivot table in excelupdate sql database from excelfinancial analyst interview questions and answers pdf