Frank,
This is confusing worksheet functions with
VB/VBA functions. Functions can
change the attributes of the container application (such as worksheet cell
attributes) if they are not called from a worksheet function, just like a
sub.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Frank Kabel" wrote in message
...
Hi Rob
one difference between sub and functions:
Function can not change the Excel environment. That is they can't
change formats, other cells, etc. Only subs can do this.
Also have a look at http://www.cpearson.com/excel/differen.htm
--
Regards
Frank Kabel
Frankfurt, Germany
Rob van Gelder wrote:
Something that I've always been curious about, but never found a real
reason behind.
Why do we use a Sub instead of using a Function?
Is there any reason other than a Sub returns nothing?
These both do exactly the same thing:
Function Test()
MsgBox "test"
End Function
Sub Test()
MsgBox "test"
End Sub
At the moment my opinion is that Sub is redundant and may as well
never be used.
Thoughts? Comments?