VBA Programming Workshop

## Demonstrations

Introduction to VBA Programming

## Exercises

1 | Record a VBA macro to set the font in cell "A1" to 14 point bold. |

2 | Construct a VBA macro to greet you with "Good morning", "Good afternoon" or "Good evening" as appropriate. |

3 | Construct a VBA macro to toggle the display of gridlines. Assign the keyboard shortcut Crtl+G. |

4 | Construct a VBA macro to display the Excel color palette in the top left corner of an empty worksheet (cells "A3:H9"), |

5 |
Extend the previous macro to display the ColorIndex in each cell. |

6 | Can you identify which colors in the standard palette are duplicated? How many distinct colors are there? |

7 |
Construct a worksheet to compute the factorial function up to 6! = 720
without using the Excel function Fact. Verify your
calculations with Fact. |

8 |
Write a VBA function Factorial to emulate Fact assuming an
integer argument. |

9 |
How does your function react to non-integer arguments, e.g. 4.5? How can
you fix this so that it behaves like Fact. |

10 | How does your function react to negative arguments? |