LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default Change message to include range

Norman,
I owe you an apology your first suggested solution was correct.

If WorksheetFunction.CountA(Range("I28:I1000")) = _
WorksheetFunction.Count(Range("I28:I1000")) Then


When you asked me to run code to determine if K22 was upper or lowercase I
run your code above again making sure it was in uppercase and it worked.

Cheers
Pat

"Norman Jones" wrote in message
...
Hi Pat,

Please replace the suggested diagnostic sub with:

Sub Info()

If [k22].Value = "QS" Then
MsgBox "Uppercase!"
ElseIf UCase([k22]) = "QS" Then
MsgBox "Other case"
ElseIf InStr(1, [k22], "QS", vbTextCompare) 0 Then
MsgBox "SUBSTRING!"
Else
MsgBox "Not Found!"
End If
End Sub


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Pat,

I am afraid none of the options you kindly submitted worked. The data
contained in Range("I28:I1000")
is the result of a formula.


The Count and CountA functions, used in all responses to you , respond to
formula-returned values in the same way as they would to directly entered
data. So clearly there is something else going on here!

When you say:

I am afraid none of the options you kindly submitted worked


I am not sure that I understand. Are you saying that the formulas in
Range("I28:I1000") return values but the supplied code does not cause the
msgbox to report this fact? I believe that if this is your experience,
then the problem probaly relates to Cell k22,

Please do two things:

(1) Please respond to the question implicit in my previous post, nanely:
do you want to delete data if the range is (a)all numeric, (b) part
numeric or (c) alpha and/or numeric. (d) some other condition

(2) With the relevant sheet active, run this simple sub and report the
response:

Sub Info()

If [k22].Value = "QS" Then
MsgBox "Uppercase!"
ElseIf UCase([k22]) = "QS" Then
MsgBox = "Other case"
ElseIf InStr([k22], "QS", vbTextCompare) 0 Then
MsgBox "SUBSTRING!"
Else
MsgBox "Not Found!"
End If
End Sub

---
Regards,
Norman



"Pat" wrote in message
...
Hello Norman,

I am afraid none of the options you kindly submitted worked. The data
contained in Range("I28:I1000")
is the result of a formula. Why I want to delete the result of any of
the
formulas in the range is because it must conform to the value in K22
which
is "QS" Any other values in K22 will not result in deleting and
information
in Range("I28:I1000").

Incidentally, do you have a reason for asking the user to find and
delete
data in the specified range rather than adapting your macro to do this?

By all means adapting the macro to delete data would be beneficial to
the
user. Would a simple

Range("I28:I1000").Select
Selection.ClearContents

be what you are thinking or have you a better way?

regards
Pat







 
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
Use RANDBETWEEN form & include certain #'s in the range texas7186 Excel Worksheet Functions 15 December 13th 09 12:43 AM
How do I include only visible cells in a range? Frequent User Excel Worksheet Functions 1 November 28th 05 04:31 PM
How do i include the original workbook in the email message creat. ebxr8 Excel Discussion (Misc queries) 4 April 9th 05 12:25 AM
sum a range of cells that include an error HeatherC Excel Discussion (Misc queries) 2 January 28th 05 10:58 AM
How do I include a wider range in my code?? nrage21[_10_] Excel Programming 4 January 22nd 04 08:49 PM


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