Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call Statement
I know that there is something that is call a 'call statement', but I do not
know how its work. In my code I duplicate about 10 lines in five different sections of code. What I was wanting to do, was locate the code that I use quite a bit in one section and then just ask for when I need it. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call Statement
sub docall() xxxxxxxx ssss call repeat ssssss ssss call repeat end sub -- Don Guillett Microsoft MVP Excel SalesAid Software "caldog" wrote in message ... I know that there is something that is call a 'call statement', but I do not know how its work. In my code I duplicate about 10 lines in five different sections of code. What I was wanting to do, was locate the code that I use quite a bit in one section and then just ask for when I need it. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call Statement
Small example with the two Subs in a module to set application properties
when running macros. Sub set_app() With Application .Calculation = xlCalculationManual .ScreenUpdating = False .DisplayAlerts = False End With End Sub Sub reset_app() With Application .Calculation = xlCalculationAutomatic .ScreenUpdating = True .DisplayAlerts = True End With End Sub You don't really need the Call statement to add those to your macros. Sub do_stuff() set_app your code to do stuff reset_app End Sub If you wanted to post an example of what 10 lines you duplicate in 5 different routines perhaps you could get more specifics. Gord Dibben MS Excel MVP On Sat, 9 Jan 2010 12:44:01 -0800, caldog wrote: I know that there is something that is call a 'call statement', but I do not know how its work. In my code I duplicate about 10 lines in five different sections of code. What I was wanting to do, was locate the code that I use quite a bit in one section and then just ask for when I need it. Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call Statement
I always figured that "Call" was best used in a button.
Private Sub CommandButton1_Click() Call set_app End Sub this way you can code and click a button for the macro to be active... "Gord Dibben" wrote: Small example with the two Subs in a module to set application properties when running macros. Sub set_app() With Application .Calculation = xlCalculationManual .ScreenUpdating = False .DisplayAlerts = False End With End Sub Sub reset_app() With Application .Calculation = xlCalculationAutomatic .ScreenUpdating = True .DisplayAlerts = True End With End Sub You don't really need the Call statement to add those to your macros. Sub do_stuff() set_app your code to do stuff reset_app End Sub If you wanted to post an example of what 10 lines you duplicate in 5 different routines perhaps you could get more specifics. Gord Dibben MS Excel MVP On Sat, 9 Jan 2010 12:44:01 -0800, caldog wrote: I know that there is something that is call a 'call statement', but I do not know how its work. In my code I duplicate about 10 lines in five different sections of code. What I was wanting to do, was locate the code that I use quite a bit in one section and then just ask for when I need it. Thanks . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call Statement
I always assumed that the "call" statement was used for setting a macro to a
button/checkbox...etc Private Sub CommandButton1_Click() Call #Name End Sub "caldog" wrote: I know that there is something that is call a 'call statement', but I do not know how its work. In my code I duplicate about 10 lines in five different sections of code. What I was wanting to do, was locate the code that I use quite a bit in one section and then just ask for when I need it. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using the Call Statement | Excel Programming | |||
Variable in call statement | Excel Programming | |||
Call Statement and Return Value | Excel Programming | |||
using an if then statement call a caption box to a cell | Excel Programming | |||
Can you call a macro as in an IF statement | Excel Programming |