<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FLanguage_Basics%2FVariable_Declaration</id>
		<title>VBA/Excel/Access/Word/Language Basics/Variable Declaration - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FLanguage_Basics%2FVariable_Declaration"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Language_Basics/Variable_Declaration&amp;action=history"/>
		<updated>2026-04-05T07:52:26Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Language_Basics/Variable_Declaration&amp;diff=1170&amp;oldid=prev</id>
		<title> в 16:33, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Language_Basics/Variable_Declaration&amp;diff=1170&amp;oldid=prev"/>
				<updated>2010-05-26T16:33:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:33, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Language_Basics/Variable_Declaration&amp;diff=1171&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Language_Basics/Variable_Declaration&amp;diff=1171&amp;oldid=prev"/>
				<updated>2010-05-26T12:46:34Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Declaring Variables==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub DeclareVariable()&lt;br /&gt;
    Dim myVar As Integer&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Forcing Declaration of Variables: Option Explicit==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Option Explicit&lt;br /&gt;
Sub CalcCost() &amp;quot; revised CalcCost procedure&lt;br /&gt;
    &amp;quot; declaration of variables&lt;br /&gt;
    Dim slsPrice As Currency&lt;br /&gt;
    Dim slsTax As Single&lt;br /&gt;
    Dim cost As Currency&lt;br /&gt;
    Dim strMsg As String&lt;br /&gt;
    slsPrice = 35&lt;br /&gt;
    slsTax = 0.085&lt;br /&gt;
    cost = Format(slsPrice + (slsPrice * slsTax), &amp;quot;0.00&amp;quot;)&lt;br /&gt;
    strMsg = &amp;quot;The calculator total is &amp;quot; &amp;amp; &amp;quot;$&amp;quot; &amp;amp; cost &amp;amp; &amp;quot;.&amp;quot;&lt;br /&gt;
    MsgBox strMsg&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==If you&amp;quot;re going to declare multiple variables on one line, make sure each variable is specifically declared==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub dSub()&lt;br /&gt;
    Dim intCounter As Integer, intAge As Integer, intWeight As Integer&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==To declare a variable in VBA use the Dim (short for Dimension) statement.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub inttype()&lt;br /&gt;
    Dim myVar As Integer&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Variable declaration is required with Option Explicit and a module level variable (answer) is declared.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Option Explicit&lt;br /&gt;
Dim answer As Integer&lt;br /&gt;
Sub Main()&lt;br /&gt;
   Dim num1 As Integer&lt;br /&gt;
   Dim num2 As Integer&lt;br /&gt;
   num1 = Val(InputBox(&amp;quot;Please enter the first addend&amp;quot;, &amp;quot;First Addend&amp;quot;))&lt;br /&gt;
   num2 = Val(InputBox(&amp;quot;Please enter the second addend&amp;quot;, &amp;quot;Second Addend&amp;quot;))&lt;br /&gt;
   Call AddUserInput(num1, num2)&lt;br /&gt;
   SendResult&lt;br /&gt;
End Sub&lt;br /&gt;
Private Sub AddUserInput(num1 As Integer, num2 As Integer)&lt;br /&gt;
    answer = num1 + num2&lt;br /&gt;
End Sub&lt;br /&gt;
Private Sub SendResult()&lt;br /&gt;
    MsgBox (&amp;quot;The answer is &amp;quot; &amp;amp; Str(answer))&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Variables can also be declared in the declarations section at the top of a module==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
     Option Explicit&lt;br /&gt;
     Dim Sales&lt;br /&gt;
     Sub Scope1()&lt;br /&gt;
         Sales = Sales + 1&lt;br /&gt;
         MsgBox Sales&lt;br /&gt;
     End Sub&lt;br /&gt;
     Sub Scope2()&lt;br /&gt;
         Sales = Sales + 10&lt;br /&gt;
         MsgBox Sales&lt;br /&gt;
     End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>