ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Conditional Statement (https://www.excelbanter.com/excel-programming/360838-dynamic-conditional-statement.html)

gti_jobert[_97_]

Dynamic Conditional Statement
 

Hi all,

I want to be able to apply a dynamic conditional IF statement, for
example;

conditional = "and Range("A30").Value = "60""

If ActiveCell.Value = 40 conditional then
'Do Something
End If

Is it possible for the above to work? I know it doesn't work as shown
above so is there a workaround for it?

Thanks All!


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=539832


[email protected]

Dynamic Conditional Statement
 
If activecell.value=40 and range("A30").value=60 then
'condition tests as true
'#####################################
' not sure if you meant 60 in quotes though!
'#####################################
end if


gti_jobert[_98_]

Dynamic Conditional Statement
 

I dont think you understood what I wanted to do.....

I want the condition variable to be a dynamic so I can put it into the
loop - the problem I have is too large to put in here - I just want to
know if I can set DYNAMIC CONDITIONAL STATEMENTS.



Wrote:

If activecell.value=40 and range("A30").value=60 then
'condition tests as true
'#####################################
' not sure if you meant 60 in quotes though!
'#####################################
end if



--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:
http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=539832


[email protected]

Dynamic Conditional Statement
 
You can't build a conditional if statement like this as a string, but
you may not need to - what makes it conditional - is it (for example)
that you are moving gradually away from a given cell (at which point
OFFSET comes in handy) or is the value 30 variable - at which point,
why?



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com