How to collect all non-zero data from a string of zero and non-zero data into an array using vbscript

I have an excel sheet that has 144 coulms- (4 columns contains one set) .ie 36 sets that I have. Now, how can I extract only Non-Null data from Excel 2000X350 worksheet matrix data into a 2D array using VBScript?

Here is an example:

PID T1 T1SD T1CD T1ST T2 T2SD T2CD T2ST T3 T3SD T3CD T3ST T4 T4SD T4CD T4ST ........ 10 abbtrtklo 11 ppmdnnnb . . 

PID on column number 11 is always. The data set consists of (TN, TNSD, TNCD, TNST), where N = 1 to 36. The array will not collect data into it only if the set contains NUll data. After all the data has been received, it must then pass the data to each row. But keep in mind that if a 2D array needs to assign data to the row from where it was raised.

Data (1,1) = (a, b, b, t ,, r, t, k, l, o) At the time of collection Cell (2,12) = (a, b, b, t ,, r, t , k, l, o) when releasing data.

which means that the data should be displayed in the correct rows (setwise)

Please let me know if you have any confusion.

EDIT: Output Table

  PID T1 T1SD T1CD T1ST T2 T2SD T2CD T2ST T3 T3SD T3CD T3ST T4 T4SD T4CD T4ST 10 abbtrtklo 11 ppmdnnnb 

Thanks Arup

+1
source share
1 answer

Here is a partial answer that should push you in the right direction.

 Sub Macro1() Dim whichT As Integer Dim whichC As Integer Dim allNull As Boolean Dim contents As String For whichT = 0 to 8 ' this is which T set allNull = True for whichC = 1 to 4 ' this is which of the 4 elements contents = Cells(2, whichT * 4 + whichC + 1) Debug.Print "Contents of col ", whichT * 4 + whichC + 1, "are", contents If Len(contents) > 0 then allNull = False ' any one of the non-blank elements sets to False Next whichC If allNull Then ... ' do some processing to move over the next 4. Next whichT End Sub 
+1
source

All Articles