[HW 1.1b] VBA – First Function and First Sub

Functions
Write a custom visual basic function that converts Fahrenheit temperatures to Celsius and use it in a spreadsheet. The formula to convert Celsius to Fahrenheit is: F = (9/5)*C + 32

To check your calculations, you might know the following

Crossover Freezing     Boiling
Celsius -40 0 20 30 100
Fahrenheit -40 32 68 86 212

Save this function as an add-in in a personal function workbook.

Subs
For this course, it will be necessary to hand in printed pages.  I prefer receiving models or analyses that are properly formatted for printing such that everything fits nicely on the appropriate number of pages.

Here’s a quick blog post from Chandoo on how to navigate setting these page parameters properly.  I generally hit Alt-F-P-G to get to the page setup tab, but Chandoo has a way that you may find easier. I learned something I didn’t know from this post. Two points for Chandoo.

http://chandoo.org/wp/2009/12/22/print-excel-one-page-across/

1. Record a print macro and figure out how to run it.  As part of the macro, you should have the path and filename in 8 point font in the lower left footer, the time and date in the lower right footer, and your name in the top right header.

2. Save this in a personal macro workbook, so that it is always available whenever you are working in Excel.

3. Turn in a print out of a working example of your function, together with the code for both your function and your print macro.

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: