|
| Further Modification of Module1 |
 |
|
Picture 1: Code #3
|
|
|
| - |
A welcome functionality would be default values for header and footer,
if e.g. left header or right footer are empty.
This functionality can be accomplished as follows.
|
| - |
For sake of clarity we use here constants, HL1 and FR1.
They are added after DIM statement (in red color).
|
| - |
We make the macro read constant HL1 when no left header information exists.
"If" .. "Then".. "Else" statement is inserted in the code (in blue color).
|
| - |
We make the macro read constant FR1 when no right footer information exists.
Another "If" .. "Then".. "Else" statement is inserted in the code (in green color).
|
|
| The Result:
|
| - |
Now the macro works as expected. Here, is a view to a brand new worksheet through UserForm1.
|
|
 |
| Picture 2: UserForm1 when macro is run |
|
|
|
| Macro download
|
| - |
You can download final codes of both the macro and the UserForm1 (Packed with WinZip) here.
|
|
|