VBA Lecture Part 1
VBA Lecture Part 1
Surgery hours
My lectures will be delivered as today, by using a Power Point presentation. The same lecture notes that I use every week for my presentation will be made available to you for downloading through Moodle (see later) from my web-page. You will be able to print the notes every week before the lecture and bring them along to the lecture. You may still take your own notes during the lecture. Todays notes are already available from the web page. Also Labs exercise sheets and solutions, as well as previous years tests can be obtained from the same page.
3
All the material for the course (and, in principle all other courses you are doing this year) is accessible through the Virtual Learning Environment called Moodle. You can access Moodle by going to: https://moodle.city.ac.uk
Or by clicking on the moodle icon if you are using a City University Computer. This week (Maths students), instead of having a programming Lab on Thursday from 13:00 to 15:00, will get an introduction to Moodle. Similar arrangements should have been made for Actuarial Science students. 4
Programming MA1603 is divided into two parts, contributing a total of 15 credits. Part I will be lectured in term 1 and Part II in term 2. During both terms you will have a 1 hour lecture and 2 hour lab per week (slightly Structure of different for Act. Sci. students). the module For Actuarial Science students, Programming is just half of their AS1054 module. The other half is Computational Mathematics which some Mathematics students take as a separate module with code MA1616.
Assesment method
For Maths students, the final mark for the module will be obtained as the average of the marks of the two tests that will be carried out in January (for Part I) and in May (for Part II). In order to pass the module this average must be at least 40%, although it is not necessary to achieve 40% for each of the tests individually. For Act. Sci. students, their final mark for AS1054 will be obtained as the average of the Programming and Computational Mathematics marks.
Excel
Applications: Widespread use in Industry, Finance & Engineering Excel 2007 is part of the Office 2007 Package. Besides Excel it contains: Word for creating text documents Powerpoint for creating presentations (like this one) Access for creating databases
Outlook for email
8
Reading list The lecture notes for this module are partly based on several text books which can be useful for different parts of the module. The lecture notes and your class notes should be sufficient for you to understand every aspect of the module. If you have used Excel before, you will find the first few weeks of lectures very easy (it will get harder!) The following text books will be helpful for different parts of the module. Some books concentrate only on Excel, others cover only VBA. They are also of different levels. Copies of all these books are available in our library.
Books for complete beginners (as they appear on the library catalogue at http://library.city.ac.uk/)
VBA
Excel
10
More advaced books (as they appear on the library catalogue at http://library.city.ac.uk/)
VBA
Excel
Excel
11
Getting Started Log into the City University system Select Excel in the following way Start Programs M to N Microsoft Office Microsoft Office Excel 2007
12
12
application window
title bar
standard toolbar
formatting toolbar c o l u m n H
row 17
13
13
minimize window quick access toolbar formula bar active cell reference area status bar active sheet scroll bars non-active sheets
14
14
The active worksheet is the one highlighted, e.g. above it is Sheet1. A new sheet can become the active sheet by clicking on its name, e.g. Sheet2 or Sheet3. One can insert new sheets, delete, rename, move and copy existing ones by right clicking on the name. WS consist of vertical columns labeled by letters A,B,C... and horizontal rows labeled by numbers 1,2,3,... 15
15
The intersection of a row and a column is called a cell referred to by the letter of the column and number of the row, e.g. B5, AF1,... An active cell is the cell currently in use. It is marked by a bold black frame.
formula bar reference area active cell
The formula bar displays the content of the active cell. The reference area indicates the position of the active cell, e.g. B2 An active cell can be de-activated by clicking on another cell, which then becomes the new active cell. Data are manipulated on the WS in the active cell.
16
A collection of cells is called a range. It is referred to by the name of the cell in the top left corner and the cell in the lower right corner, e.g. B2:E5 are 16 cells.
One can select a range by enlarging the active cell area. This is done by placing the screen pointer into the active cell, pressing the left mouse button and dragging the pointer down to the right to define the lower right corner of the range. Releasing the left mouse button will leave a bold frame surrounding the range. A collection of worksheets is called a workbook (WB). The name of the workbook is displayed in the title bar, e.g. Examplebook
17
The Excel window consists of two windows, the document window and the application window. The document window contains the worksheets, scroll bars, ...
the scroll bars allow to move to parts of the window which are currently invisible, e.g. the range K4:P25. the minimize button skrinks the document window the maximize button enlarges the window to the full size of the application window the close button closes the document window The application window contains the Excel commands, menues... menu bars contain the main Excel commands, File, Edit,..., 18 which by themselves contain a wide range of commands
18
control windows (minimize, maximize, close) allow to resize move, close and restore the application window standard toolbars offer various options such as copying, printing, cutting, pasting, etc. formatting toolbars offer various options to change the format of the individual cell and the entire WS quick access toolbar allows you to add commands that are used frequently and are not accessible from the default toolbars. the status bar displays the progress of the commands or operations which are currently executed, e.g Edit when text is being edited or Ready when no command is executed
19
19