Summary
This article introduces a method of merging two columns of data using the Excel macro editor, which is suitable for scenarios where the system cannot recognize formulas when data is imported in batches. Call the macro editor through Alt+F11, insert the module and paste the sample code, specify the merge range of columns D and K, and use Alt+F8 to execute the macro to achieve data integration. This method avoids the problem of formula failure and improves data processing efficiency.
Usage scenario: When I was importing data from a certain system in batches, the system requirements must be filled in according to the given template. Since I had a lot of data, I initially used the formula =A+B to operate, but found that the system could not recognize it, so I used Excel's macro editor for data integration.
Test data display

Sample code
Sub CombineColumns()
Dim lastRow As Long
Dim i As Long
lastRow = 85 ' D2:D85 和 K2:K85 的行数
For i = 2 To lastRow
Cells(i, 4).Value = Cells(i, 4).Value & Cells(i, 11).Value ' D列是第4列,K列是第11列
Next i
End Sub
Operation steps
In the excel interface alt+f11, click Insert Module on the pop-up interface and paste the above code.

The second step is to press alt+f8 and click execute

Results display












