VBA study notes (6) - extract the first column called "Hong Hong" personal information VBA study notes (6) - extract the first column called "Hong Hong" personal information

Description (2017.3.25):

1. knowledge of dim arr2 (1 to 1000, 1 to 4) large enough to define a two-dimensional array, or the need to transpose the transposed behind a one-dimensional array.

Copy the code
All information 1 'extraction list called "Hong Hong" is provided arr2 array 1-1000, transposition may be omitted Step 
 2 Public Sub test1 () 
 . 3 Dim ARR, arr2 (the To 1 1000 1 the To. 4), K 
 . 4 ARR the Range = ( "A1: d5 of") 
 . 5 'MsgBox (the UBound (ARR)) 
 . 6' the Stop 
 . 7. 1 the To the UBound the For I = (ARR,. 1) 
 . 8 ARR the If (I,. 1) = "Hong Hong" the Then 
 . 9 K = K +. 1 
10 arr2 is (K,. 1) = ARR (I,. 1) 
. 11 arr2 is (K, 2) = ARR (I, 2) 
12 is arr2 is (K,. 3) = ARR (I,. 3) 
13 is arr2 is (K, . 4) = ARR (I,. 4) 
14 Cells (I,. 5) = "this" 
15 End the If 
16 the Next 
. 17 the Range ( "A" & (2 + I)). the Resize (K,. 4) = arr2 is 
18 is End Sub

Description (2017.3.25):

1. knowledge of dim arr2 (1 to 1000, 1 to 4) large enough to define a two-dimensional array, or the need to transpose the transposed behind a one-dimensional array.

Copy the code
All information 1 'extraction list called "Hong Hong" is provided arr2 array 1-1000, transposition may be omitted Step 
 2 Public Sub test1 () 
 . 3 Dim ARR, arr2 (the To 1 1000 1 the To. 4), K 
 . 4 ARR the Range = ( "A1: d5 of") 
 . 5 'MsgBox (the UBound (ARR)) 
 . 6' the Stop 
 . 7. 1 the To the UBound the For I = (ARR,. 1) 
 . 8 ARR the If (I,. 1) = "Hong Hong" the Then 
 . 9 K = K +. 1 
10 arr2 is (K,. 1) = ARR (I,. 1) 
. 11 arr2 is (K, 2) = ARR (I, 2) 
12 is arr2 is (K,. 3) = ARR (I,. 3) 
13 is arr2 is (K, . 4) = ARR (I,. 4) 
14 Cells (I,. 5) = "this" 
15 End the If 
16 the Next 
. 17 the Range ( "A" & (2 + I)). the Resize (K,. 4) = arr2 is 
18 is End Sub

Guess you like

Origin www.cnblogs.com/medik/p/10989733.html