#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Arrays

Excel 2000

How do I:

1. load a list of data into an array;
2. check whether cells in another list are contained in
that array (highlighting cells which are not)

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Arrays

There's almost certainly a better, more efficient and
cleverer way to do this, but this code reads a list of
values in column A into an array, then compares every
value in column B against that list and makes the cell
bold if it's not a match.

Sub InArray()

Dim MyArray() As String
Dim X As Integer, Y As Integer
Dim NumEle As Integer
Dim Lastrow As Integer

NumEle = Application.WorksheetFunction.CountA_
(ActiveSheet.Columns(1))

ReDim MyArray(NumEle)

For X = 1 To NumEle
MyArray(X) = Cells(X, 1).Value
Next X

Lastrow = Range("B65536").End(xlUp).Row

For X = 1 To Lastrow
Cells(X, 2).Font.Bold = True
For Y = 1 To NumEle
If Cells(X, 2).Value = MyArray(Y) Then
Cells(X, 2).Font.Bold = False
End If
Next Y
Next X

End Sub

' Cheers, Pete
-----Original Message-----
Excel 2000

How do I:

1. load a list of data into an array;
2. check whether cells in another list are contained in
that array (highlighting cells which are not)

Thanks.
.

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
Avg Arrays PAL Excel Worksheet Functions 2 February 13th 09 06:02 PM
Arrays Tobro88 Excel Discussion (Misc queries) 3 November 18th 05 11:28 PM
Arrays Chip Pearson Excel Programming 0 February 3rd 04 07:35 PM
arrays again RobcPettit Excel Programming 3 January 24th 04 10:33 PM
arrays solo_razor[_44_] Excel Programming 2 December 15th 03 12:06 PM


All times are GMT +1. The time now is 08:03 AM.

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

About Us

"It's about Microsoft Excel"