landscape test 2

16
CO4001 Data Analysis Modelling 4 Automation & catch up

Upload: adam-kassab

Post on 28-Mar-2016

215 views

Category:

Documents


0 download

DESCRIPTION

landscape test 2

TRANSCRIPT

Page 1: landscape test 2

CO4001Data Analysis

Modelling 4Automation & catch up

Page 2: landscape test 2

What is a macro? O Small program that runs inside the Excel

application (VBA)O Allows you to:

O Record procedures that take many stepsO Subsequently run them with a keystroke or the

click of a buttonO Alter the procedure by changing the code (if

you want!)

Page 3: landscape test 2

Macro Security O Macro Security

O Enable macros O Disable macrosO Do not Open

Page 4: landscape test 2

To display Developer tab on Ribbon – from File menu

Page 5: landscape test 2

To Set Security Level

Page 6: landscape test 2

Record a Macro Example 1. Plan what you wish to record2. Do it manually to check you know what to do3. For example – using the Countries sheet we

want to sort the countries into EU and non-EU then by Population:1. Highlight required cells A4 to F492. Sort by EU descending3. Sort by Population ascending

4. Check it works (First country in list Luxembourg?)

5. Now sort on Country ascending ready to record

Page 7: landscape test 2

Record a Macro Developer>Record Macro

Page 8: landscape test 2

Run Macro CountrySort

OR CTRL + p

Developer > Macros >Run

Page 9: landscape test 2

Delete a Macro Developer > Macros > Delete

Page 10: landscape test 2

Attaching a Macro to a Button(Form Control)

Buton 1

Page 11: landscape test 2

Assign a macro to a ButtonSelect the relevant Macro > OK

Page 12: landscape test 2

Give the Button a LabelRight-click then Edit Text

Page 13: landscape test 2

Editing Macros Developer>Macros>Edit

Page 14: landscape test 2

VB Macro Code

Page 15: landscape test 2

Hide Sheet TabsFile > Options >Advanced, Scroll to Display options for worksheet, Deselect show sheet tabs, Click ok

Page 16: landscape test 2

Workshop

O Exercise 4.1 CountrySort macroO Exercise 4.2 ViewReport macroO Exercise 4.3 Menu macroO Exercise 4.4 & 4.5 LookupsO Discussion Board contribution