Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Amaross
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Otto Moehrbach
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Amaross
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing a macro that will exit a spreadsheet Dave Doc New Users to Excel 2 January 26th 06 01:41 PM
Macro to copy cells to rows below [email protected] Excel Discussion (Misc queries) 1 January 20th 06 06:59 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
How do I stop macro alerts for a spreadsheet with no macros in it DKS044 Excel Discussion (Misc queries) 1 June 23rd 05 03:53 PM
Macro that copy page to page just some filled cells LC Excel Discussion (Misc queries) 0 May 13th 05 11:22 PM


All times are GMT +1. The time now is 12:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"