0% found this document useful (0 votes)
4 views

Lesson 4L Macro Programming

This document serves as an introduction to Excel programming, covering various Microsoft Office versions and essential skills such as worksheet functions, formatting, data handling, and macro writing. It includes exercises for practical application, including data validation, filtering, sorting, and protection of cells, as well as an overview of Visual Basic for Applications (VBA) for macro creation. Additionally, it outlines the structure of a supplier database with input restrictions for managing supplier information.

Uploaded by

Bugoy Libao
Copyright
© © All Rights Reserved
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lesson 4L Macro Programming

This document serves as an introduction to Excel programming, covering various Microsoft Office versions and essential skills such as worksheet functions, formatting, data handling, and macro writing. It includes exercises for practical application, including data validation, filtering, sorting, and protection of cells, as well as an overview of Visual Basic for Applications (VBA) for macro creation. Additionally, it outlines the structure of a supplier database with input restrictions for managing supplier information.

Uploaded by

Bugoy Libao
Copyright
© © All Rights Reserved
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
You are on page 1/ 7

LESSON 4L- INTRODUCTION TO EXCEL PROGRAMMING

Microsoft OffIce Version


1. Microsoft Office 2003 - Classic View
2. Microsoft Office 2007
3. Microsoft Office 2010
4. Microsoft Office 2013

Things to master in Excel Programming

1. Worksheet functions
a. Basic functions - ex. MDAS, AVE, IF, etc
Discussed in Lesson 3L
b. Advance functions - ex. VLOOKUP, SUMIF
c. Customized functions - ex. Converting numbers into texts

2. Formatting
a. Basic Formatting - The use of Ctrl + 1 Discussed in Lesson 3L
b. Conditional Formatting - ALT + O + D
Exercise 1 :
What to do: Format the cell according to the conditions

input here >

Write "apple" in the box, then the box will turn into red.
If you write "banana" it will turn into green, then if
you do not writing anything, or you write other words
aside from apple and banana, the box will show no color

c. Hide / Unhide Worksheet


d. Office Options - The use of ALT- T - O

3. Data Handling
a. Data validation - ALT + D + L Discussed in Lesson 3L

b. Filtering - Filtering data per column


Exercise 1: Put Data Filtering

Jo No. Date JO Type Qty Order Needed


0001 11/05/15 Flyers 1,000.00 11/08/15
0002 11/06/15 Box 2,000.00 11/09/15
0003 11/07/15 Box 3,000.00 11/10/15
0004 11/08/15 Flyers 4,000.00 11/11/15
0005 11/09/15 Magazine 500.00 11/12/15
0006 11/10/15 Invitation 3,000.00 11/13/15

c. Sorting - Alphabetical/Numerical ordering either ascending or descending


Exercise 2: Sorting, 1. Sort by JO Type, by JO No., by Qty Order. Ascending and Descending

Jo No. Date JO Type Qty Order Needed


0005 11/09/15 Magazine 500.00 11/12/15
0001 11/05/15 Flyers 1,000.00 11/08/15
0002 11/06/15 Box 2,000.00 11/09/15
0003 11/07/15 Box 3,000.00 11/10/15
0006 11/10/15 Invitation 3,000.00 11/13/15
0004 11/08/15 Flyers 4,000.00 11/11/15

d. Protection - Protecting cells and formula


Exercise 3 - Protecting Cell
A B C D AVERAGE
215.00 215.00 3.00 108.25

What to do:
1. Data Validation - Limit data input in columns A to D, whole number from 1 to 100 only
2. Protect the average cell, J47.

e. Text to Column - Importing text file and designating it into columns

lcbajpclass page 1
Exercise 4 - Importing text file
What to do:
1. Open Text File. Check the file then close it.
2. From the excel file, click sheet2. Click File, Open the text file. (To view all the files in the
folder, select file types - all files)
3. An option box will appear then listen to the professor for instruction

4. Macro writing and recording

Macros can be used to


a . automate repetitive tasks
b. document what you did
c. share common procedures
d. add tools to the toolbar
e. add keyboard shortcuts

Visual Basic Application - Language use in macro writing and recording

Other langauages: General Purpose


ALGOL An attempt to design a universal language
BASIC A simple, easy-to-learn language designed for beginners
C, C++ A very powerful languages with excellent speed and control over the computer
COBOL A language for business programming
Pascal A language to teach students how to program "correctly"
Visual Basic A version of BASIC designed for creating Windows applications
Visual C++ A version of C++ designed for creating Windows applications

Ways to write Macro Programming


a. Macro Recording - built-in tape recorder in excel, that listens and records everything you do in VBA language
steps:
1. Insert BUTTON from the toolbars of FORMS. Edit the BUTTON name into "RED".

2. Put your cursor anywhere you like, as long as you can see it, or just inside the box.

3. Record new macro


4. Color the cell red
5. Stop recording
6. Assign the recorded Macro into the RED Button
7. Run the macro
8. View the Code ALT + F11

b. Customize Macro Programming


1. Discussion of VBA Editor
Understanding the Visual Basic Editor:
Before understanding the MakeMeRed macro, we need to be familiar with VBE (Visual
Basic Editor.) See this drawing to understand it.

lcbajpclass page 2
Viewing the VBA behind the macro recorded
1. Select Module 1 from left side area of VBE (called as Project Explorer).
2. Double click on it to open it in Editor Area (top right, big white rectangle)
3. You can see the VBA Code behind the recorded macro

2. VBA Programming language


a. Creating a procedure
1 Sub SubName ()
End Sub
2 Function FunctionName ()
End Function

B. Understanding the procedure


1 Comments
2 Constant
3 Declaration of Variables
4 Range
5 Sheet

lcbajpclass page 3
SUPPLIER DATABASE

SUPPLIER NAME

ADDRESS

CONTACT PERSON

CONTACT NO.

SUPPLIER NAME ADDRESS CONTACT PERSON


>
03/21/25

VAT TYPE LINE

TIN REGISTRATION STATUS


VAT GOODS

VAT TYPE
NON-VAT SERVICES

LINE

CONTACT NO. TIN VAT TYPE LINE


INPUT RESTRICTION: DUPLICATE SUPPLIER (1=YES /0 =N

VAT TYPE LINE OF BUSINESS

NON-VAT GOODS

VAT SERVICES
DUPLICATE SUPPLIER (1=YES /0 =NO)

You might also like