View
224
Download
0
Category
Preview:
Citation preview
8/12/2019 MS. Excell VBA-#1, July 24, 2013
1/16
MS Office 2007
VBA Excel 2007
Microsoft Excel
http://ads.rtbidder.net/click?p=1&n=51ef54662907c24fb85a0523&ad=51ac4f968bc06f11844c0de6&wid=471805114&pid=-2785541578652884876&vid=4032&mod=0&dp=311&pos=1&sid=&pub=10000&dvc=1402&co=360&st=0&mt=0&ct=0&pcode=&tz=420&ord=20130724T041327&dlid=&click=http%3A%2F%2Fadclick.g.doubleclick.net%2Faclk%3Fsa%3Dl%26ai%3DCjmkXZlTvUfS2CsaliAeulIDACf7NopcC9saPvk-25eeyXBABIABQgMfhxARg6QKCARdjYS1wdWItMzk2ODUxNDY2MDg3MDAxNKABqsyc4QPIAQmoAwGqBJUBT9AuI4rsgYb4VkYCueAzznmab7FcXZKOZwhkVglq8YGnLIDbYAVdvam5F_29X7wLQzyO1hwWSt2PAZhR1v9bkbuTRNgiH4VTwGrdNVDtiT7mAEGTtZiDhBgkBz7Fih2BN8_YfEp6jRnO1lAxSvqN5YFx0omlwM1iP5SetZaz3KfxuiITKOGlljp1y7gYAC6CjU7PlF-ABu6Isv-zs9eX9QE%26num%3D1%26sig%3DAOD64_1CokVaSubR00bqljm4tujYNsfH1g%26client%3Dca-pub-3968514660870014%26adurl%3D&url=http://ad.doubleclick.net/click;h=v2|40C8|0|0|%2a|v;272860304;0-0;0;98806833;31-1|1;54498944|54384449|1;;%3fhttps://feelthebeauty.sony-asia.com?cid=Bravia:dsp:accuen:ID:std_ban:ron_vert:300x250:s2http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3968514660870014&format=fp_al_lp&output=html&h=90&w=160&lmt=1291793211&ad_type=text_image&flash=11.8.800&url=http%3A%2F%2Fwww.functionx.com%2Fvbaexcel%2Ffundamentals%2FLesson1.htm&dt=1374639206345&bpp=30&bdt=762&shv=r20130718&cbv=r20130206&saldr=sa&correlator=1374639206608&frm=20&adk=1599413332&ga_vid=1136788103.1374639207&ga_sid=1374639207&ga_hid=1090957517&ga_fc=0&u_tz=420&u_his=1&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=32&u_nplug=14&u_nmime=56&dff=verdana&dfs=13&adx=179&ady=240&biw=1349&bih=624&oid=3&ref=http%3A%2F%2Fwww.functionx.com%2Fvbaexcel%2F&fu=0&ifi=1&pfi=0&dtd=361&xpc=ZEH9edHIFu&p=http%3A//www.functionx.com&kw_type=radlink&prev_fmts=160x90_0ads_al&rt=ChBR71RlAAdvJQrinEOkAHVzEg9NaWNyb3NvZnQgRXhjZWwaCO6C80cDspKMIPSkmsYCKAFI9KSaxgJSEwja6aGMose4AhXpo-IKHcQsAE0&hl=en&kw0=MS+Office+2007&kw1=VBA+Excel+2007&kw2=Microsoft+Excel&okw=Microsoft+Excelhttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3968514660870014&format=fp_al_lp&output=html&h=90&w=160&lmt=1291793211&ad_type=text_image&flash=11.8.800&url=http%3A%2F%2Fwww.functionx.com%2Fvbaexcel%2Ffundamentals%2FLesson1.htm&dt=1374639206345&bpp=30&bdt=762&shv=r20130718&cbv=r20130206&saldr=sa&correlator=1374639206608&frm=20&adk=1599413332&ga_vid=1136788103.1374639207&ga_sid=1374639207&ga_hid=1090957517&ga_fc=0&u_tz=420&u_his=1&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=32&u_nplug=14&u_nmime=56&dff=verdana&dfs=13&adx=179&ady=240&biw=1349&bih=624&oid=3&ref=http%3A%2F%2Fwww.functionx.com%2Fvbaexcel%2F&fu=0&ifi=1&pfi=0&dtd=361&xpc=ZEH9edHIFu&p=http%3A//www.functionx.com&kw_type=radlink&prev_fmts=160x90_0ads_al&rt=ChBR71RlAAdvIgrinEOkAHVzEg5WQkEgRXhjZWwgMjAwNxoIgQDMgFZtPHUg9KSaxgIoAUj0pJrGAlITCNrpoYyix7gCFemj4godxCwATQ&hl=en&kw0=MS+Office+2007&kw1=VBA+Excel+2007&kw2=Microsoft+Excel&okw=VBA+Excel+2007http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-3968514660870014&format=fp_al_lp&output=html&h=90&w=160&lmt=1291793211&ad_type=text_image&flash=11.8.800&url=http%3A%2F%2Fwww.functionx.com%2Fvbaexcel%2Ffundamentals%2FLesson1.htm&dt=1374639206345&bpp=30&bdt=762&shv=r20130718&cbv=r20130206&saldr=sa&correlator=1374639206608&frm=20&adk=1599413332&ga_vid=1136788103.1374639207&ga_sid=1374639207&ga_hid=1090957517&ga_fc=0&u_tz=420&u_his=1&u_java=1&u_h=768&u_w=1366&u_ah=728&u_aw=1366&u_cd=32&u_nplug=14&u_nmime=56&dff=verdana&dfs=13&adx=179&ady=240&biw=1349&bih=624&oid=3&ref=http%3A%2F%2Fwww.functionx.com%2Fvbaexcel%2F&fu=0&ifi=1&pfi=0&dtd=361&xpc=ZEH9edHIFu&p=http%3A//www.functionx.com&kw_type=radlink&prev_fmts=160x90_0ads_al&rt=ChBR71RlAAdvFArinEOkAHVzEg5NUyBPZmZpY2UgMjAwNxoI2U71Wr7Pwysg9KSaxgIoAUj0pJrGAlITCNrpoYyix7gCFemj4godxCwATQ&hl=en&kw0=MS+Office+2007&kw1=VBA+Excel+2007&kw2=Microsoft+Excel&okw=MS+Office+2007http://www.google.com/url?ct=abg&q=https://www.google.com/adsense/support/bin/request.py%3Fcontact%3Dabg_afc%26url%3Dhttp://www.functionx.com/vbaexcel/fundamentals/Lesson1.htm%26gl%3DID%26hl%3Den%26client%3Dca-pub-3968514660870014&usg=AFQjCNEdLG6sQ28SQ01KjoHJwtgwVfvm1Q8/12/2019 MS. Excell VBA-#1, July 24, 2013
2/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 2/16
The Office Button
Introduction
When Microsoft Excel opens, it displays an interface divided in various sections. The top section
displays the title bar which starts on the left side with the Office Button . If you position the
mouse on it, a tool tip would appear:
The Options of the Office Button
When clicked, the Office Button displays a menu:
As you can see, the menu of the Office Button allows you to perform the routine Windows
operations of a regular application, including creating a new document, opening an existing file, or
saving a document, etc. If you right-click the office button, you would get a short menu:
We will come back to the options on this menu.
The Quick Access Toolbar
Introduction
The Quick Acc ess Toolbar is on the right side of the Office Button. It displays afew buttons. If you right-click the Quick Access toolbar, a menu would appear:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
3/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 3/16
To hide the Quick Access toolbar, you can right-click it and click Remove Quick Access Toolbar. If
you position the mouse on a button, a tool tip would appear.
In the beginning, the Quick Access toolbar displays only three buttons: Save, Undo, and Redo. If
you want more buttons than that, you can right-click the Quick Access toolbar and click Customize
Quick Access Toolbar... This would display the Excel Options dialog box:
To add a button to the Quick Access toolbar, on the left list of Add, click an option and click Add.
After making the select ions, c lick OK.
To remove a button from the Quick Access toolbar, right-click it on the Quick Access toolbar and
click Remove From Quick Access Toolbar.
The Quick Access Button
A button with a down-pointing arrow displays on the right side of the Quick Access toolbar. You
can click or right-click that button to display its menu:
The role of this button is to manage some aspects of the top section of the Microsoft Excel
interface, including deciding what buttons to display on the Quick Access toolbar. For example,
instead of using the Customize Quick Access Toolbar menu item as we saw previously, you can
click an o tion from that menu and its corres ondin button would be added to the uick Access
http://www.googleadservices.com/pagead/aclk?sa=L&ai=C-pGzZlTvUZ2tEejKigeTrIHoBPuD29oDm9m18Fna2R4QASDcj4ECUOLi8u_-_____wFg6QKgAa_PxP4DyAECqAMByAPRBKoElQFP0Kuxo5X2mM_7d6ojRpxHQlPIgT-vlMxlo_7a3OdHYgztibnvkpspjQggBvtc5PtYmbuP11P6c5SbmNzTDptBd5MAh1LBJl5MdpR1sMk-8WJ_fy5MEcDvCShTewPk86nrwUfvy7azJq211kl4qs8T7YD16oxAqqZzvU5NexvMeF4sM8b4iTqs4fsN-eVbguU7SnlE8YgGAaAGAoAHubC7AQ&num=1&cid=5GhtZNEZJn_7PK8ZXL2hirJm&sig=AOD64_3kEbA6_O8H9Gyj_rGSveov_f-n_w&client=ca-pub-3968514660870014&adurl=http://www.tekscan.com/interface-load-gauge%3Futm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_term%3Dload%2Bgage%26utm_content%3Dad2%26utm_campaign%3Dpressure%2Bdisplayhttp://www.functionx.com/excel/dlgboxes/options2.gif8/12/2019 MS. Excell VBA-#1, July 24, 2013
4/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 4/16
toolbar. If the options on the menu are nor enough, you can click either Customize Quick Access
Toolbar or More Commands... This would open the Excel Options dialog box.
The main or middle area of the top section displays the name of the application: Microsoft Excel.
You can right-click the title bar to display a menu that is managed by the operating system.
On the right side of the title bar, there are three system buttons that allow you to minimize,
maximize, restore, or close Microsoft Access.
Under the title bar, there is another bar with a Help button on the right side.
The Ribbon
Introduction
Under the title bar, Microsoft Excel displays the Ribbon:
By default, the Ribbon displays completely in the top section of Microsoft Excel under the title bar.
One option is to show it the way the main menu appeared in previous versions of Microsoft Excel.
To do this:
Right-click the Office Button, the Quick Access toolbar, or the Ribbon itself, and click Minimize
the RibbonClick or right-click the button on the right side of the Quick Access toolbar:
This would display the Ribbon like a main menu:
To show the whole Ribbon again:
Right-click the Office Button, the Quick Access toolbar, or one of the Ribbon menu items, and
click Minimize the Ribbon to remove the check mark on it
Click or right-click the button on the right side of the Quick Access toolbar and click Minimize
the Ribbon to remove the check mark on it
Double-c lick one of the menu items of the Ribbon
Changing the Location of the Ribbon
By default, the Quick Access toolbar displays on the title bar and the Ribbon displays under it. If
you want, you can switch their locations. To do that, right-click the Office Button, the Quick
Access toolbar, or the Ribbon, and click Show Quick Access Toolbar Below the Ribbon:
http://www.googleadservices.com/pagead/aclk?sa=L&ai=C-pGzZlTvUZ2tEejKigeTrIHoBPuD29oDm9m18Fna2R4QASDcj4ECUOLi8u_-_____wFg6QKgAa_PxP4DyAECqAMByAPRBKoElQFP0Kuxo5X2mM_7d6ojRpxHQlPIgT-vlMxlo_7a3OdHYgztibnvkpspjQggBvtc5PtYmbuP11P6c5SbmNzTDptBd5MAh1LBJl5MdpR1sMk-8WJ_fy5MEcDvCShTewPk86nrwUfvy7azJq211kl4qs8T7YD16oxAqqZzvU5NexvMeF4sM8b4iTqs4fsN-eVbguU7SnlE8YgGAaAGAoAHubC7AQ&num=1&cid=5GhtZNEZJn_7PK8ZXL2hirJm&sig=AOD64_3kEbA6_O8H9Gyj_rGSveov_f-n_w&client=ca-pub-3968514660870014&adurl=http://www.tekscan.com/interface-load-gauge%3Futm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_term%3Dload%2Bgage%26utm_content%3Dad2%26utm_campaign%3Dpressure%2Bdisplay8/12/2019 MS. Excell VBA-#1, July 24, 2013
5/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 5/16
To put them back to the default locations, right-click the Office Button, the Quick Access toolbar,
or the Ribbon, and click Show Quick Access Toolbar Above the Ribbon.
The Tabs of the Ribbon
The ribbon is a type of property sheet made of various property pages. Each page is represented
with a tab. To access a tab:
You can click its label or button, such as Home or Create
You can press Alt or F10. This would display the access key of each tab:
To access a tab, you can press its corresponding letter on the keyboard. For example, when
the access keys display, if you press Home, the Home tab would display
If your mouse has a wheel, you can position the mouse anywhere on the ribbon, and role the
wheel (on the mouse). If you role the wheel down, the next tab on the right side would be
selected. If you role the wheel up, the previous tab on the left side would be selected. You can
keep rolling the wheel until the desired tab is selected
To identify each tab of the Ribbon, we will refer to them by their names.
The Sections of a Tab
Each tab of the ribbon is divided in various sections, each delimited by visible borders of vertical
lines on the left and right. Each section displays a title in its bottom side. In our lessons, we will
refer to each section by that title. For example, if the title displays Font, we will call that section,
"The Font Section".
Some sections of the Ribbon display a button . If you see such a button, you can c lick it. This
would open a dialog box or a window.
The Buttons of the Ribbon
Since there are various buttons and sometimes they are unpredictable, to know what a particular
button is used for, you can position your mouse on it and a tool tip would appear:
You can also use context sensitive help in some cases to get information about an item.
You can add a button from a section of the Ribbon to the Quick Access toolbar. To do that, right-click the button on the Ribbon and click Add to Quick Access Toolbar:
Remember that, to remove a button from the Quick Access toolbar, you can right-click it on the
Quick Access toolbar and click Remove From Quick Access Toolbar.
The More Buttons of the Ribbon
In some sections of the Ribbon, on the lower-right corner, there is a button:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
6/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 6/16
That button is used to display an intermediary dialog box for some actions.
The Size of the Ribbon
When Microsoft Excel is occupying a big area or the whole area of the monitor, most buttons of the
Ribbon appear with text. Sometimes you may need to use only part of the screen. That is, you may
need to narrow the Microsoft Excel interface. If you do, some of the buttons may display part of
their appearance and some would display only an icon. Consider the difference in the following
three sc reenshots:
In this case, when you need to access an object, you can still click it or click its arrow. If the item
is supposed to have many objects, a new window may appear and display those objects:
From this:
To this:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
7/16
8/12/2019 MS. Excell VBA-#1, July 24, 2013
8/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 8/16
A cell is identified by its name and every cell has a name. By default, Microsoft Excel appends the
name of a row to the name of a column to identify a cell. Therefore, the top-left cell is named A1.
You can check the name of the cell in the Name Box.
The Scroll Bars
On the right side of the cells area, there is a vertical scroll bar that allows you to scroll up and
down in case your document cannot display everything at a time:
In the lower right section of the main window, there is a horizontal scroll bar that allows you to
scroll left and right if your worksheet has more items than can be displayed all at once:
Sometimes the horizontal scroll bar will appear too long or too narrow for you. If you want, you can
narrow or enlarge it. To do this, click and drag the button on the left side of the horizontal scroll
bar:
The Sheet Tabs
On the left side of the horizontal scrollbar, there are the worksheet tabs:
By default, Microsoft Excel provides three worksheets to start with. You can work with any of them
and switch to another at any time by clicking its tab.
The Navigation Buttons
8/12/2019 MS. Excell VBA-#1, July 24, 2013
9/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 9/16
On the left side of the worksheet tabs, there are four navigation buttons:
If you happen to use a lot of worksheets or the worksheet names are using too much space, which
would result in some worksheets being hidden under the horizontal scroll bar, you can use thenavigation buttons to move from one worksheet to another.
The Status Bar
Under the navigation buttons and the worksheet tabs, the Status Bar provides a lot of information
about the job that is going on.
Microsoft Excel File Operations
Saving a File
A Microsoft Excel file gets saved like any traditional Windows file. To save a file:
You can press Ctrl + S
On the Quick Access Toolbar, you can click the Save button
You can click the Office Button and click Save
Two issues are important. Whenever you decide to save a file for the first time, you need to
provide a file name and a location. The file name helps the c omputer identify that particular file and
register it.
A file name can consist of up to 255 characters, you can include spaces and dashes in a name.
Although there are many characters you can use in a name (such as exclamation points, etc), try
to avoid fancy names. Give your file a name that is easily recognizable, a litt le explicit. For example
such names as Time Sheets, Employee's Time Sheets, GlobalEX First Invoice are explicit enough.
Like any file of the Microsoft Windows operating systems, a Microsoft Excel file has an extension,
which is .xls but you don't have to type it in the name.
The second important piece of information you should pay attention to when saving your file is the
location. The location is the drive and/or the folder where the file will be saved. By default,
Microsoft Excel saves its files in the My Documents folder. You can change that in the Save As
dialog box. Just click the arrow of the Save In combo box and select the folder you want.
Microsoft Excel allows you to save its files in a type of your choice. To save a file in another
format:
Press F12 or Shift + F12
You can click the Office Button and position the mouse on Save As and select the desired
option:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
10/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 10/16
On the Quick Access Toolbar, you can click the Save button . Then, in the Save As dialog
box, click the arrow of the Save As Type combo box and select a format of your choice
There are other things you can do in the Save As dialog box:
Saving under a Different Name and New Folder
You can save a file under a different name or in another location, this gives you the ability to work
on a copy of the file while the original is intact.
There are two primary techniques you can use to get a file in two names or the same file in two
locations. When the file is not being used by any application, in Windows Explorer (or in My
Computer, or in My Network Places, locate the file, right-click it and choose Copy. To save the file
in a different name, right-click in the same folder and choose Paste. The new file will be named
Copy Of... You can keep that name or rename the new file with a different name (recommended).
To save the file in a different location, right-click in the appropriate folder and click Paste; in this
case, the file will keep its name.
In Microsoft Excel, you can use the Save As dialog box to save a file in a different name or save
the file with the same name (or a different name) in another folder. The Save As dialog box also
allows you to create a new folder while you are saving your file (you can even use this technique
to create a folder from the application even if you are not saving it; all you have to do is create
the folder, click OK to register the folder, and click Cancel on the Save As dialog box).
Opening a File
The files you use could be created by you or someone else. They could be residing on your
computer, on another medium, or on a network. Once one of them is accessible, you can open it in
your application.
You can open a document either by double-clicking its icon in Windows Explorer, in My Computer,
from the Find Files Or Folders window, in My Network Places, or by locating it in the Open dialog
box. To access the open dialog box, on the main menu, click File -> Open... You can also click the
Open button on the Standard toolbar.
A shortcut to call the Open dialog box is Ctrl + O.
Files Properties
Every file has some characteristics, attributes, and features that make it unique; these are its
properties. You can access a file's properties from three main areas on the computer:
If the file is saved on the desktop and/or it has a shortcut on the desktop, if you open My
Computer, Windows Explorer, or the folder (as a window) where the file is stored, right-click the
file and click Properties. If the file were saved on the desktop, you would see only some of its
properties, the most you can do there is to assign a Read-Only attribute. In My Computer and
Windows Explorer, you will be able to change t he file's properties.
Before opening a f ile or while in the Open dialog box, you c an view some of the file's properties
although you won't be able to change them.
When the file is opened in Microsoft Excel, you can click the Office Button, position the mouse
on Prepare, and click Properties. This would display some of the most common attributes of the
file:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
11/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 11/16
To change an item, you can click its text box and edit or replace the content. To get more
options, you can click the Document Properties button and click Advanced Properties...
A file's properties are used for various reasons. For example, you can find out how much size the
file is using, where it is located (the hosting drive and/or folder), who created the file, or who was
the last person to access or modify it. The Properties dialog box is also a good place to leavemessages to other users of the same file, about anything, whether you work as a team or you
simply want to make yourself and other people aware of a particular issue regarding the file.
Microsoft Visual Basic FundamentalsIntroduction
Microsoft Excel is a spreadsheet application that provides simple to advanced means of creating
and managing any type of list. To enhance it beyond its default function, it ships with a language
called Microsoft Visual Basic or simply Visual Basic.
Microsoft Visual Basic for Applications (VBA) is a computer language based on Microsoft Visual
Basic. It allows you to write code that can automatically perform actions on a document and/or its
content. When using that language, you write pieces of code, using an external environment.
Microsoft Visual Basic is a programming environment that gets automatically installed when you
setup Microsoft Excel. It stays apart because most people would not need or use it. This means
that, if you want to use the Microsoft Visual Basic programming environment that ships with
Microsoft Excel, you must ask for it, which can be easily done.
Launching Microsoft Visual Basic
In our lessons, we will learn how to use both Microsoft Excel and Microsoft Visual Basic to create
and manage spreadsheets. The Microsoft Visual Basic programming environment we will use
depends on Microsoft Excel. As a result, to use Microsoft Visual Basic, you must first open
Microsoft Excel. Then, to write code, you must open Microsoft Visual Basic. There are various ways
you can do this, depending on your intention.
To launch Microsoft Visual Basic using the default installation of Microsoft Excel and launching from
a macro, on the Ribbon, you can click View. In the Macros section, click the arrow under the
Macros button and click Record a Macro:
This would display the Record Macro dialog box:
On the Record Macro dialog box, (do something or) simply click OK. Then, in the Macros section of
the Ribbon, click the arrow under the Macros button and click Stop Recording. Now, to open
Microsoft Visual Basic in the Macros sect ion of the Ribbon click either the Macros button itself or
8/12/2019 MS. Excell VBA-#1, July 24, 2013
12/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 12/16
click the arrow under it and click View Macros:
In the combo box, select the name of the macro you created (if you have only one, it should be
selected already) and click Edit.
There is probably the best way for a programmer like you to launch Microsoft Visual Basic. Click the
Office Button and click Excel Options. In the Excel Options dialog box, click the Show Developer tab
in the Ribbon check box and click OK. The Ribbon would become equipped with a new tab:
From the Developer tab of the Ribbon, to launch Microsoft Visual Basic, click the Visual Basic
button.
Practical Learning: Starting Microsoft Visual Basic
1. Click the Office Button and click Excel Options
2. In the Excel Options dialog box, click the Show Developer tab in the Ribbon check box:
3. Click OK
4. In the Code section of the Developer tab of the Ribbon, to launch Microsoft Visual Basic, c lick
Visual Basic:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
13/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 13/16
The Microsoft Visual Basic Interface
Introduction
When it opens, like any regular Windows application, Microsoft Visual Basic displays a title bar in
the top section. Under the title bar, the application displays a menu, followed by a Standard
toolbar.
To assist you with your development, Microsoft Visual Basic can display various windows.
The Project Explorer
The Project Explorer window shows a list of the code segments that are available to your
worksheet. It is usually available whenever you open Microsoft Visual Basic. It is usually positioned
in the top-left section. If it is not present, to display it, on the main menu of Microsoft Visual Basic,
you can click View -> Project Explorer. To close it, you can click its Close button .
You can move the Project Explorer to another section of the interface. To do this, click its title bar
and drag it away it from there:
To put the window back where it was previously, you can double-click its title bar.
The Project Explorer
The Properties window is usually positioned in the bottom-left section of the screen. When it does
not appear, to display it, on the main menu, c lick View -> Properties Window:
8/12/2019 MS. Excell VBA-#1, July 24, 2013
14/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 14/16
The Properties Window shows the characteristics of an object that is selected. Like any other
window, to move the Properties window from its position, drag its title bar:
The main area of Microsoft Visual Basic uses a gray background. This area is gray because, in
reality, Microsoft Visual Basic is a multiple document interface (MDI) that can be used to display
various windows at the same time. At times, this gray area will be occupied with other windows.
Modules
A module is a blank window that resembles a piece of paper on which you write code. When you
use Microsoft Excel and work on a document, a default module is automatically allocated for it,
whether you use it or not. You can also create a module that is independent of any worksheet.
To create a module, on the main menu of Visual Basic, you can click Insert -> Module.
Practical Learning: Creating a Module
1. On the main menu of Microsoft Visual Basic, click Insert -> Module
2. Notice that a blank window with a blinking caret appears
8/12/2019 MS. Excell VBA-#1, July 24, 2013
15/16
24/07/13 Microsoft Excel VBA: Introduction
www.functionx.com/vbaexcel/fundamentals/Lesson1.htm 15/16
The Immediate Window
To help you test code, Microsoft Visual Basic provides a special window called the Immediate
Window. To display it, on the main menu of Microsoft Visual Basic, you can click View -> Immediate
Window.
Practical Learning: Displaying the Immediate Window
1. To display the Immediate Window, on the main menu of Visual Basic, c lick View -> Immediate
Window
2. Notice that a window with an Immediate t itle bar appears at the bot tom with a blinking caret
8/12/2019 MS. Excell VBA-#1, July 24, 2013
16/16
24/07/13 Microsoft Excel VBA: Introduction
3. To return to Microsoft Excel, on the Standard toolbar of Visual Basic, c lick the View Microsoft
Excel button
Home Copyright 2009-2010 FunctionX, Inc.
http://www.functionx.com/vbaexcel/index.htmhttp://www.functionx.com/vbaexcel/index.htmRecommended