SimpleProgramExercise ch.9

SimpleProgramExercise ch.9 - Chapter 9 Demonstration...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 9 Demonstration: Writing a Simple VBA Program (without recording a macro) Tasks performed in this exercise: 1. In a new Excel workbook, insert a new VBA Module 2. Rename the module to “FirstProgram” 3. Begin a new procedure: Sub SimpleProgram 4. At the top of the module, type the VBA code “Option Explicit” a. Set the Excel options so that Option Explicit appears at the top of VBA modules. (Tools Options Editor (tab) Require variable declaration) 5. Capture text input from user using an “input box” (person’s name) a. Declare a variable to hold the name 6. Capture a text date (person’s birth date) from user a. Declare a variable to hold the text date 7. Convert the text date to a Date value a. Declare a variable to hold the Date value b. Use the CDate function to convert a text date to a Date value 8. Calculate the person’s age a. Declare a variable to hold the calculated age b. Use the VBA NOW() function to return the current date c. Use the VBA INT() function to return only the integer value from the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/15/2011 for the course ACIS 2504 at Virginia Tech.

Page1 / 2

SimpleProgramExercise ch.9 - Chapter 9 Demonstration...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online