LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Code is not correct

if cells(21,11).value = "QS" then
range("i28:i950").clearcontents
end if



Pat wrote:

The only other option open to me if I cannot get the correct code is to
incorporate code that would delete whatever is in the range I28:I950 if
"QS" is in cell:
If Cells(21, 11).Value = "QS" Then

Any ideas how this could be achieved?

Pat

"Pat" wrote in message
...
Hi folks,

Thank you for helping me out. I have been trying out our suggestions and

I
have been not getting the result I am looking for.

If Application.CountIf(Range("I28:I950"), """") 0 Then


The above did not return the message from the MsgBox as I have tried out
having a value greater than 0 in the range I28:I950. If there is a vale

in
any of the cells in the range I28:I950 the MsgBox should warn the user.


-----------------------------

If all the cells in I28:I950 contain the formula you mention, use
COUNTIF(E1:F10,"") This will count cells that are either truly empty or
appear empty because of a formula yields "".


I am not sure where E1:F10 comes from but I have modified the formula in
I28:I950 to look like:

=COUNTIF(J76,"=")

instead of:

=IF(J76="","",J76)

By using what I think is your suggestion this will yield 1 if J76 is empty
and empty if J76 contains a value.

Unfortunately this is not what is needed.

Regards
Pat




"Dave Peterson" wrote in message
...
=counta() includes all formulas--including those that evaluate to "".

Maybe you could use a different formula:

If Application.CountIf(Range("I28:I950"), """") 0 Then

(I like application.countif, but you could still use

worksheetfunction.countif.)

Pat wrote:

The messagebox appears even though there is no data in I28:I950
For some reason it thinks there is data in the range, only the formula

as
mentioned will be in the range.

"Tushar Mehta" wrote in

message
...
What do you want it to do?

"Pat" wrote:

The following code is not correct.


If WorksheetFunction.CountA(Range("I28:I950")) 0 Then
If Cells(21, 11).Value = "QS" Then
MsgBox "There is data in column I28:I950, find and

delete
this
data. You cannot have any data in the Quantity Ordered column when

you
are
creating a Quick Sale invoice. "
Exit Sub
End If
End If


There is a formula in cell in the range I28:I950
For eg. =IF(J76="","",J76)


I will appreciate any and all help.

Thanks
Pat




--

Dave Peterson




--

Dave Peterson
 
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
How to search for a code, and have the correct information auto fi Jared Excel Discussion (Misc queries) 4 November 9th 09 05:04 AM
#Value! error on code that should be correct? RHein Excel Discussion (Misc queries) 2 January 3rd 08 03:19 AM
Code for Correct location of Add-ins for all versions of Excel Charles Jordan Excel Programming 12 February 24th 05 04:02 PM
Help to correct code Pat Excel Programming 6 December 29th 04 05:02 PM
Can you help with the correct translation of this code? Just For Fun... Excel Programming 0 September 30th 04 06:16 AM


All times are GMT +1. The time now is 04:35 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"