Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statement in VBA

Hi I'm using the following formula in a routine:

Range("G11:CX298").Formula = "=IF(AND($DX11<$B11,$G11="".""),$DZ11)"


If the criteria = true then it placecs the value of $DZ11 which is wan
I want.

What do I put in for the false part of the statement if I want to tak
no action? I don't want to clear or change the contents at all if th
condition is false.

Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default If statement in VBA

If you want to put a formula in the cell then it has to
take an action. Otherwise you could do something like
this:

If Range("DX11").Value < Range("B11").Value And Range
("G11").Value = "" Then
Range("G11:CX298").Value = Range("$DZ11").Value
End If

tod

-----Original Message-----
Hi I'm using the following formula in a routine:

Range("G11:CX298").Formula = "=IF(AND

($DX11<$B11,$G11="".""),$DZ11)"


If the criteria = true then it placecs the value of

$DZ11 which is want
I want.

What do I put in for the false part of the statement if

I want to take
no action? I don't want to clear or change the contents

at all if the
condition is false.

Thanks


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default If statement in VBA

The formula as written checks each row and makes a determination for that
particular row against the values in that row. Your check only checks a
single row and then imposes the formula on all rows, 11 to 298. I agree
with you comment, but you would need to loop down the range and check the
conditions for each row, posting a result particular to that row.

--
Regards,
Tom Ogilvy

"Tod" wrote in message
...
If you want to put a formula in the cell then it has to
take an action. Otherwise you could do something like
this:

If Range("DX11").Value < Range("B11").Value And Range
("G11").Value = "" Then
Range("G11:CX298").Value = Range("$DZ11").Value
End If

tod

-----Original Message-----
Hi I'm using the following formula in a routine:

Range("G11:CX298").Formula = "=IF(AND

($DX11<$B11,$G11="".""),$DZ11)"


If the criteria = true then it placecs the value of

$DZ11 which is want
I want.

What do I put in for the false part of the statement if

I want to take
no action? I don't want to clear or change the contents

at all if the
condition is false.

Thanks


---
Message posted from http://www.ExcelForum.com/

.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statement in VBA

Thanks for the input guys, back to the drawing board..

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default If statement in VBA

Once you put the formula in, it overwrites whatever was there. If you just
want the cell to appear blank, then you would put in """" for the false
condition. If you mean the cell already contains something which you want
to retain, then you can't do that unless for each cell in the range, you
build the formula individually for each cell, putting the current value as
the False result.

--
Regards,
Tom Ogilvy


"hotherps " wrote in message
...
Hi I'm using the following formula in a routine:

Range("G11:CX298").Formula = "=IF(AND($DX11<$B11,$G11="".""),$DZ11)"


If the criteria = true then it placecs the value of $DZ11 which is want
I want.

What do I put in for the false part of the statement if I want to take
no action? I don't want to clear or change the contents at all if the
condition is false.

Thanks


---
Message posted from http://www.ExcelForum.com/





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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
Help please, IF statement/SUMIF statement Brad_A Excel Worksheet Functions 23 January 11th 05 02:24 PM


All times are GMT +1. The time now is 01:21 PM.

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

About Us

"It's about Microsoft Excel"