in

The Assignment Operator
We have already seen the first of VBA's operators: the assignment operator, which is just the equals sign (=). It is used to assign the result of an expression to a variable.
Always keep in mind that VBA always derives the result of the right side of the equation (that is, the expression) before it modifies the value of the left side of the equation.

For example, consider the following code fragment:

currentYear = 2004
currentYear = currentYear + 1

The first statement assigns the value 2004 to the currentYear variable. The second statement also changes the value stored in the currentYear, but it uses the expression currentYear + 1 to do it. This looks weird until you remember that VBA always evaluates the expression first. In other words, it takes the current value of currentYear, which is 2004, and adds 1 to it. The result is 2005 and that is what's stored in currentYear when all is said and done.

Arithmetic Operators
VBA's arithmetic operators are similar to those you use to build Excel formulas.


OperatorNameExampleResult
-Subtraction13-211
-Negation-5-5
*Multiplication3*26
/Division8/24
\Integer Division9\24
^Exponential2^38
ModModulus9 Mod 21

The Mod operator works like Excel's MOD() worksheet function. In other words, it divides one number by another and returns the remainder. Here's the general form to use:

result = dividend Mod divisor

Here, dividend is the number being divided; divisor is the number being divided into dividend; and result is the remainder of the division. For example, 16 Mod 5 returns 1 because 5 goes into 16 three times with a remainder of 1.

The Concatenation Operator
You use the concatenation operator (&) to combine text strings within an expression. One way to use the concatenation operator is to combine string literals. For example, consider the following expression:

"soft" & "ware"

The result of this expression is the following string:

software

You can also use & to combine not just String operands, but numeric and Date operands, too. Just remember that the result will always be of the String data type.

Comparison Operators
You use the comparison operators in an expression that compares two or more numbers, text strings, variables, or function results. If the statement is true, the result of the formula is given the logical value True (which is equivalent to any nonzero value). If the statement is false, the formula returns the logical value False (which is equivalent to 0).


OperatorNameExampleResult
=Equal to3=2False
>Greater than3>2True
<Less than3<2False
>=Greater than or equal to"a">="b"False
<=Less than or equal to"a"<="b"True
<>Not equal to"a"<>"b"True

Logical Operators
You use the logical operators to combine or modify True/False expressions.


OperatorGeneral FormWhat It Returns
AndExpr1 And Expr2True if both Expr1 and Expr2 are True; False otherwise.
OrExpr1 Or Expr2True if at least one of Expr1 and Expr2 are True; False otherwise.
XorExpr1 Xor Expr2False if both Expr1 and Expr2 are True or if both Expr1 and Expr2 are False; True otherwise.
NotNot ExprTrue if Expr is False; False if Expr is True.

bctZIqsnPnL

AvHvLS dgemihsmcfja, [url=http://ltwsiakrrust.com/]ltwsiakrrust[/url], [link=http://ypsmnwsklzoi.com/]ypsmnwsklzoi[/link], http://auvyrtyfkkcq.com/

Tiffany,cheap handbags the

Tiffany,cheap handbags the famous jewelry manufacturerChristian Louboutin Sale is renowned all around the globe. Designer HandbagsAfter it originally set up the shop in 1945, Gucci Jewelryit now has expanded ever since.Wholesale Personal GPS tracker It is always dedicated for creating high quality beautiful and elegant jewelries items.Cheap GPS Receiver loggerTiffany Jewelry Among the wide range, abercrombie wholesalethe sterling silver items are the mostAbercrombie Men Hoodies favorable and popular. Abercrombie Men SlippersSkilled jewelers put great replica jewelryeffort and care in any detail,Tiffany & Co. Charms making sure that they are Links Of Londonall made to very high standard.sheepskin boots That's theUGG Australia Bailey Buttonreason Tiffany jewelries stand Ugg Australia Upside Tallout from the rest.
Gucci Designer Positano Medium Tote-Peach 153033

Gucci Japanned Sheepskin BagWith Inner Leather-Black 190241

Gucci PVC With CowhideLeather Handbag-Bronze-coloured 197953

Gucci PVC With CowhideLeather Handbag-Apricot&Orange 193603

Gucci PVC With CowhideLeather Handbag-Bronze-coloured 193603

Gucci PVC With CowhideLeather Handbag-Seven Revising 193603

SlHCxnGXkBs

5pELsW eqwwswgrhjsn, [url=http://lofnmqofoygx.com/]lofnmqofoygx[/url], [link=http://oldrbepbpppf.com/]oldrbepbpppf[/link], http://qaufzzvtlelv.com/

ar artist Rolex Oyster

ar artist Rolex Oyster Daytona Chronograph Automatic replica watch is Eleanore Macnish, a discount rolex replicas watches former Topekan now living cheap exact replicas in Albuquerque, N.M. She makes "happy" jewelry, as Jimmy Choo sale she calls it, that replica Louis Vuitton incorporates bright, colorful lampwork replica handbags beads. Her signature bead is a black bead tiffany replica silver jewelry with raised white dots replica jewelry on it. The store replica tiffany jewelry can't get enough of her black and white earrings to add cheap Tag Heuer Link Quartz Chronograph T_HEU-30-885 watch replica to the collections of watches replica her followers. Margie Weidenbaker Jaeger-leCoultre watches replica and the Glass Expressions staff spend a lot cheap jerseys of time educating their NFL jersey customers about the processes cheap jersey used in glass bead- making. You can learn more replica louis vuitton purses about cased, sparkling glass replica chanel handbags beads that have glass replica chanel tote bags pigment under clear glass from internation

Suggested Book to learn VBA