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: 3
Default Iteratively removing data from a VBA array

I initially wanted to be able to truncate an array as needed by the
code. An answer along with the initial code was found in a GoogleGroup.


When though an array that has stored numeric values is truncated, the
nature of the data stored is changed. For example, the values of the
array prior to truncation would be plain numbers e.g. 1, 2, 3 etc
whereas after running the truncation section, the remaining values
change into "1", "2", "3", etc.

I have attempted to convert to an Integer value but as shown below, it
was ineffective. Comparisons of data derived from the array with
distinctly defined numbers numbers are possible. Comparisons with
variables to which values have been pre-assigned are unfortunately not
possible.

As this does not allow any further array manipulation & valid data
extraction, I have reached a standstill and would appreciate any
suggestions anyone would have to offer.

Many thanks

Kostas

PS. VBA code example of array truncation as follows :



Sub Array_truncation()


vv = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)


var1 = 2

Debug.Print ""
Debug.Print "New Run"

For Each x In vv
Debug.Print x

Next x

If vv(2) = var1 Then Debug.Print "2=2 ok" Else Debug.Print "problem at
stage 1"

Debug.Print (2)
Dim Unique
Unique = Chr(255)


' This example is "Zero" based, so index is 4 & 8
vv(4) = Unique

'Now, delete them...
vv = Filter(vv, Unique, False)

Debug.Print ""

For Each x In vv

Debug.Print x

Next x

If vv(2) = var1 Then Debug.Print "2=2 ok" Else Debug.Print "problem at
stage 2"


vv(4) = Unique

'Now, delete them...
vv = Filter(vv, Unique, False)

Debug.Print ""

Dim x2 As Integer


For Each x In vv
x = x2
Debug.Print x

Next x

If vv(2) = var1 Then Debug.Print "2=2 ok" Else Debug.Print "problem at
stage 3"



End Sub

 
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
removing a cell from an array Desperate Excel Discussion (Misc queries) 2 October 19th 08 08:31 AM
Removing Data Tables formed from importing data from Access Andrea Jones Excel Discussion (Misc queries) 0 April 10th 08 12:01 PM
Global array data got erased after removing reference in VBA Santh Excel Programming 1 February 7th 06 12:56 PM
removing blank entries from an array TheIrishThug[_5_] Excel Programming 2 December 19th 05 09:34 PM
Scanning for Duplicate Data in a Column, Merging Data and Finally Removing All Duplicates...? : VB : Excel Programming 2 August 24th 03 02:22 PM


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