Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Testing Spreadsheet Cells while in a Macro
I have created a macro with a loop which periodically has to check a
spreadsheet cell (Boolean value) in order to branch to different sub-routines. Since VBA makes a distinction between 'parameter' (structure) and 'argument' (value), the parameter definition in the sub-declaration line does not allow for its value to be tested, eliciting the error: "argument is not optional". How then does one test for a cell's value while in a macro? The cell in question toggles between 0 and 1 depending on data coming in via DDE. It determines what action should take place in the macro. I know that the value of an argument can be passed manually to a macro, as in, -Call (macro-name) (argument), however, this is not practical in this case because of the large amount of data involved. What then is VBA's equivalent for the 'procedural' line: -If (cell/name) = True Then...../Else...../Endif? Any suggestions will be appreciated. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Testing Spreadsheet Cells while in a Macro
Not sure if this is what you want, but the code is:
If Range("CellName").Value = "True" Then 'Task if True Else 'Task if False End If Please post back if I missed what you want/need. HTH Otto "Amaross" wrote in message ... I have created a macro with a loop which periodically has to check a spreadsheet cell (Boolean value) in order to branch to different sub-routines. Since VBA makes a distinction between 'parameter' (structure) and 'argument' (value), the parameter definition in the sub-declaration line does not allow for its value to be tested, eliciting the error: "argument is not optional". How then does one test for a cell's value while in a macro? The cell in question toggles between 0 and 1 depending on data coming in via DDE. It determines what action should take place in the macro. I know that the value of an argument can be passed manually to a macro, as in, -Call (macro-name) (argument), however, this is not practical in this case because of the large amount of data involved. What then is VBA's equivalent for the 'procedural' line: -If (cell/name) = True Then...../Else...../Endif? Any suggestions will be appreciated. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Testing Spreadsheet Cells while in a Macro
This is exactly what I need. You made my day. Thank you ever so much!
"Otto Moehrbach" wrote: Not sure if this is what you want, but the code is: If Range("CellName").Value = "True" Then 'Task if True Else 'Task if False End If Please post back if I missed what you want/need. HTH Otto "Amaross" wrote in message ... I have created a macro with a loop which periodically has to check a spreadsheet cell (Boolean value) in order to branch to different sub-routines. Since VBA makes a distinction between 'parameter' (structure) and 'argument' (value), the parameter definition in the sub-declaration line does not allow for its value to be tested, eliciting the error: "argument is not optional". How then does one test for a cell's value while in a macro? The cell in question toggles between 0 and 1 depending on data coming in via DDE. It determines what action should take place in the macro. I know that the value of an argument can be passed manually to a macro, as in, -Call (macro-name) (argument), however, this is not practical in this case because of the large amount of data involved. What then is VBA's equivalent for the 'procedural' line: -If (cell/name) = True Then...../Else...../Endif? Any suggestions will be appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Writing a macro that will exit a spreadsheet | New Users to Excel | |||
Macro to copy cells to rows below | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) | |||
How do I stop macro alerts for a spreadsheet with no macros in it | Excel Discussion (Misc queries) | |||
Macro that copy page to page just some filled cells | Excel Discussion (Misc queries) |