Home > Software engineering >  [for] to use data dictionary - merger to achieve conditions & fill in the rest
[for] to use data dictionary - merger to achieve conditions & fill in the rest

Time:09-16

Seek help from a great god, how to use the dictionary do processing bulk data merging (example not only 14, is a dynamic data), and partial data remain the same, in the same storage box part to add slash append
The above is the native data



The following is merging rules are based on - & gt; A high-speed & amp; E range of & amp; F known as

A high-speed & amp; E range of & amp; F nicknamed the case is the same - & gt; B trip together; C ticket together; D start on time rate peak; G note with diagonal lines append in the same storage box

[A1: G1], is to keep the same

For the great god

CodePudding user response:

What word Canon, it's a classic PivotTable scene

CodePudding user response:

Now who still in use a dictionary and direct operation Excel or use ADO to Excel operation are simple, you of the question, operated by the above methods, there should be no problem,

CodePudding user response:

 
Option Explicit

Sub merget ()
Application. ScreenUpdating=False

Dim dic As Object

Dim RNG As Range
The Set dic=CreateObject (" scripting. The dictionary ")

The Set RNG=Worksheets (" Sheet1 "). UsedRange

Dim I As an Integer, j As Integer

Dim key As String
Dim row As an Integer, krow As Integer
The row=1

Dim findStr searches As Integer
For I=1 To RNG. Rows. Count
Key=RNG. Cells (I, 1). The Value & amp; RNG. Cells (I, 6). The Value
'the Debug. The Print key
If the key="" Then GoTo the LINE

If (dic) exists (key)) Then
Krow=dic (key)
Cells (krow, 2). Value=https://bbs.csdn.net/topics/Val (Cells (krow, 2). The Value) + Val (RNG (I, 2). The Value)
Cells (krow, 3). Value=https://bbs.csdn.net/topics/Val (Cells (krow, 3). The Value) + Val (RNG (I, 3). The Value)
FindStr searches=InStr (Cells (krow, 7). The Value of RNG (I, 7). The Value)
If findStr searches=0 Then
If StrComp (Cells (krow, 7). The Value of RNG (I, 7). The Value) & lt; 0 Then
Cells (krow, 7). The Value=https://bbs.csdn.net/topics/Cells (krow, 7). The Value & "/" & amp; RNG (I, 7). The Value
The Else
Cells (krow, 7). The Value=https://bbs.csdn.net/topics/rng (I, 7). The Value & "/" & amp; Cells (krow, 7). The Value
End the If
End the If
The Else
Dic. Item (key)=row
RNG (I, 1). The Resize (1, 7). Copy
Range (Cells (row 1), Cells (row, 7)). The PasteSpecial xlPasteValuesAndNumberFormats
The row row + 1=
End the If
The LINE:
Next I
Application. ScreenUpdating=True
End Sub

  •  Tags:  
  • VBA
  • Related