LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Check for subscript out of range

Hi all,

In a function I want to fill an array with values. This function goes
through a given column on a sheet (say coumn B) and stores the values in the
array, skipping all the duplicates. Every time the function is called the
array is redimmed so it starts with an 'empty' array and then fills it.

Now in the next column (column C) i also have some values which also have to
be put into the array, again skipping the duplicates. Depending on if column
B was empty or not, the array has already got some values in it. When
proceeding to column C how can i check if the array is already populated by
at least 1 value?

I cannot use Ubound, but I can also not check for the error (subscript is
out of range) by using IsError, or something else.


code:
dim boolArrayHasNoValues as Boolean

boolArrayHasNoValues = IsError(UBound(NoDuplicates)) <<<<<<supscript is out
of range

''if NoDuplicates is not yet redim / rather if NoDuplicates has no values
yet then

For iTemp = 1 To AllCells.Cells.Count
'get first value in selection of cells, and stop this part of
the function
'this is to make sure that there are no empty values in the
array
If Not AllCells.Cells(iTemp) = "" Then
ReDim NoDupes(1)
NoDupes(1) = AllCells.Cells(iTemp)
Exit For
End If
Next iTemp
''End If





 
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
what does 'Subscript Out of range' mean?? Gary Excel Worksheet Functions 2 March 22nd 07 01:33 AM
9: Subscript out of range jenz21985 Excel Discussion (Misc queries) 6 May 5th 06 03:36 PM
Subscript Out of Range ExcelMonkey[_190_] Excel Programming 6 February 20th 05 02:46 AM
Subscript out of range? Jason Hancock Excel Programming 3 May 26th 04 07:11 PM
Subscript out of range Stacy Haskins[_2_] Excel Programming 4 April 10th 04 05:41 AM


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