【发布时间】:2016-07-18 18:08:29
【问题描述】:
我只需要为唯一 id 连接 2 列中的行。 Jeeped 帮我写了下面的代码
Option Explicit
Sub qwewreq()
Dim rw As Long
With Worksheets("Sheet3")
For rw = .Cells(.Rows.Count, "A").End(xlUp).Row - 1 To 2 Step -1
If .Cells(rw, "A").Value2 = .Cells(rw + 1, "A").Value2 Then
.Cells(rw, "B") = .Cells(rw, "B").Value2 &Chr(10) & .Cells(rw + 1, "B").Value2
.Cells(rw, "C") = .Cells(rw, "C").Value2 &Chr(10) & .Cells(rw + 1, "C").Value2
.Rows(rw + 1).EntireRow.Delete
End If
Next rw
End With
End Sub
我尝试在每个非空白值之后添加一个符号。上面的代码在每个单元格后添加符号。是否有可能以某种方式修改此代码,以便只能在非空白之后添加 Chr(10)?
谢谢!这有帮助!
【问题讨论】:
标签: vba concatenation