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

Hi there.
Say I have a worksheet with 200 cells with mostly the letter "A" in
them... All in 1 column...
There might be 1 letter "B".
I need to find out if there is a letter "B" and then return a msgbox
that says "there is at least 1 letter "B" in this column. How do I do
that?

Hope you can help me quick..

Thx
Rune Daub (VBA n00b)



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range.column

Dim rng as Range
set rng = Columns(1).Find("B")
if not rng is nothing then
msgbox "There is at least 1 letter B"
else
msgbox "There is no letter B"
End Sub

--
Regards,
Tom Ogilvy

"Rune_Daub" wrote in message
...
Hi there.
Say I have a worksheet with 200 cells with mostly the letter "A" in
them... All in 1 column...
There might be 1 letter "B".
I need to find out if there is a letter "B" and then return a msgbox
that says "there is at least 1 letter "B" in this column. How do I do
that?

Hope you can help me quick..

Thx
Rune Daub (VBA n00b)



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Range.column

thx.. I got it to work, but now I got a little harder problem.

I can easily find the letter "B" in the Columns(1)

Now I have a value in Columns(2) that I need to act on.

So that in column 2 the value can be either 1, 2, 3 or 4.

I need to find the highst value in column 2, for all columns that has
the letter B in column A, and end it with a msgbox that says
either

There is no letter B
There is a letter B and the highst value is (either 1,2,3 or 4)

How do I combine the previous script with a relative function that
reads the HIGHST value.

I know this might be a little tricky, but I hope someone got the guts
to try it on.

thx
Rune Daub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range.column

You could use an array formula in a worksheet to give you the answer

=Max(if(A1:A2000="B",B1:B2000))

so in VB

vVal = Evaluate("Max(if(A1:A2000=""B"",B1:B2000))")

That work for me
vVal will return zero if no B's are in column A. Note that you can not
examine an entire column with an array formula and to speed execution you
should limit the range you examine anyway.

--
Regards,
Tom Ogilvy


"Rune_Daub" wrote in message
...
thx.. I got it to work, but now I got a little harder problem.

I can easily find the letter "B" in the Columns(1)

Now I have a value in Columns(2) that I need to act on.

So that in column 2 the value can be either 1, 2, 3 or 4.

I need to find the highst value in column 2, for all columns that has
the letter B in column A, and end it with a msgbox that says
either

There is no letter B
There is a letter B and the highst value is (either 1,2,3 or 4)

How do I combine the previous script with a relative function that
reads the HIGHST value.

I know this might be a little tricky, but I hope someone got the guts
to try it on.

thx
Rune Daub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly 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
AVERAGE a range in a column if another column's range equals a val bob$ Excel Discussion (Misc queries) 3 February 24th 09 07:42 AM
add range in one column, subtract range in another column kasey Excel Worksheet Functions 1 October 28th 08 05:50 PM
formula to sort a range so that it matches the exact rows of a column that is outside that range? steveo Excel Discussion (Misc queries) 1 June 18th 06 02:05 AM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM
CountIf first column range = "Word" and second column range <> 0 TinaMo Excel Worksheet Functions 3 June 3rd 05 10:56 PM


All times are GMT +1. The time now is 06:52 AM.

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"