LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Determine if all items or elements are equal

Another way IF your array is a String array (which your example seems to
indicate), this method will not work with a non-String array is like this...

If Replace(Join(YourArray, ""), YourArray(LBound(YourArray))) = "" Then

if you want case sensitive equality (one < One); or like this...

If Replace(Join(YourArray, ""), YourArray(LBound( _
YourArray)), "", , , vbTextCompare) = "" Then

if you want case insensitive equality (one = One)

--
Rick (MVP - Excel)


"Shawn" wrote in message
...
Does anyone have a good way in VBA to determine if every element in an
array
is the same/equal? Or if each item in a range is the same/equal? ie. are
('one','one','one') equal? Yes. Or are ('one','one','two') equal? No.


 
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
Make sure all items in a Collection equal the same thing RyanH Excel Programming 3 September 24th 08 02:21 AM
Determine if item is in a range of items Mark Excel Programming 5 February 28th 08 01:50 PM
How do I determine which numbers in a list equal a given sum? infraterra Excel Discussion (Misc queries) 11 October 7th 05 11:39 PM
Determine which cells from a specific range equal a certain sum Maxter21 Excel Worksheet Functions 1 July 20th 05 09:44 PM
lower and upper case equal on spreadsheet but not equal in VB don Excel Programming 2 March 13th 05 12:04 AM


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