Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Called subs versus functions
I'm relatively new to VB and Excel.
Below is an example of a 'utility sub' that I use. (vars are dim'ed in declarations section.) The mso HELP does not help efficiency or other factors concerning choosing a sub or a function for code like this, or perhaps with some 'more' processing. What advice do you have? Thanks. Sub zHide_rowrange(fromrow, torow) first = fromrow last = torow hiderange = first & ":" & last Rows(hiderange).Select Selection.EntireRow.Hidden = True End Sub -- Neal Z |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Called subs versus functions
Hi Neal,
Somo lines in your code seem to be wasrefull. I would change your code like this: Sub zHide_rowrange(fromrow As Long, torow As Long) Rows(fromrow & ":" & torow).Hidden = True End Sub Regards, KL "Neal Zimm" wrote in message ... I'm relatively new to VB and Excel. Below is an example of a 'utility sub' that I use. (vars are dim'ed in declarations section.) The mso HELP does not help efficiency or other factors concerning choosing a sub or a function for code like this, or perhaps with some 'more' processing. What advice do you have? Thanks. Sub zHide_rowrange(fromrow, torow) first = fromrow last = torow hiderange = first & ":" & last Rows(hiderange).Select Selection.EntireRow.Hidden = True End Sub -- Neal Z |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Called subs versus functions
HI KL and thanks for the coding tips. As I said, I'm pretty new to this and
my method is at time to record a macro, and then generalize it. BUT, my main question is still, what are the pro's and con's of using a called sub versus a function? Thanks, again. "KL" wrote: Hi Neal, Somo lines in your code seem to be wasrefull. I would change your code like this: Sub zHide_rowrange(fromrow As Long, torow As Long) Rows(fromrow & ":" & torow).Hidden = True End Sub Regards, KL "Neal Zimm" wrote in message ... I'm relatively new to VB and Excel. Below is an example of a 'utility sub' that I use. (vars are dim'ed in declarations section.) The mso HELP does not help efficiency or other factors concerning choosing a sub or a function for code like this, or perhaps with some 'more' processing. What advice do you have? Thanks. Sub zHide_rowrange(fromrow, torow) first = fromrow last = torow hiderange = first & ":" & last Rows(hiderange).Select Selection.EntireRow.Hidden = True End Sub -- Neal Z |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Common Functions and Subs | Excel Discussion (Misc queries) | |||
Calling VBA add-in functions/subs from another Excel file. | Excel Programming | |||
General Question regarding passing cells, ranges, cell values through subs & functions | Excel Programming | |||
how to make subs/procs can only be called from within the workbook they belong to? | Excel Programming |