Home > Software engineering >  VBA extracted according to the specified date period of three columns do not duplicate data in a col
VBA extracted according to the specified date period of three columns do not duplicate data in a col

Time:11-16

Three columns of data area: A2: A100, B2: B100, C2: C100
Extraction order: A - B - C
To extract: F column
Extract content: do not repeat value (the only),

CodePudding user response:

Write well, code is as follows:
 
Option Explicit

Sub extract not duplicate values ()
Dim objRange As Range
The Set objRange=Sheet1. Range (" A2: C100)

Dim dctData As Object
The Set dctData=https://bbs.csdn.net/topics/CreateObject (" scripting. The dictionary ")

Dim objSubRange As Range
For Each objSubRange objRange In
DctData. Item (CStr (objSubRange. Value))=Null
Next

Dim As Integer I
I=2

Dim varKey As the Variant
For Each varKey dctData In
Sheet1. Cells (I, "F")=varKey
I=I + 1
Next

MsgBox "extract complete!"
End Sub

Download address:
Link: https://pan.baidu.com/s/18Ds2VICCOVnd5UgU9q9DRQ
The extracted code: cr2g

Run the example:

CodePudding user response:

Sub test ()
Arr=Range (" A2: C100)
The Set d=CreateObject (" scripting. The dictionary ")
For j=1 To UBound (arr)
For I=1 To UBound (arr, 2)
D (arr (j, I))=""
Next I
Next
[d2]. Resize, dc (mount)=WorksheetFunction. The Transpose (d.k eys)
MsgBox "extract complete!"
End Sub
  •  Tags:  
  • VBA
  • Related