Excel 字符串值操作
先生,我在Excel工作表的不同行的列中有一组类似的值,例如ABC公司、ABC公司、ABC公司、ABC公司。我希望将类似的值转换为一个值不确定您到底需要什么,但这是一个开始: 此VBA方法将在单元格上循环,计算值并将其打印到调试控制台,或使用该值设置另一个单元格Excel 字符串值操作,excel,vba,Excel,Vba,先生,我在Excel工作表的不同行的列中有一组类似的值,例如ABC公司、ABC公司、ABC公司、ABC公司。我希望将类似的值转换为一个值不确定您到底需要什么,但这是一个开始: 此VBA方法将在单元格上循环,计算值并将其打印到调试控制台,或使用该值设置另一个单元格 Sub concat() Dim rng As Range Dim row As Range Dim cell As Range Dim str As String Set rng = Ran
Sub concat()
Dim rng As Range
Dim row As Range
Dim cell As Range
Dim str As String
Set rng = Range("B3:B6")
For Each row In rng.Rows
For Each cell In row.Cells
' This is the result string:
str = str & " " & cell.Value
Next cell
Next row
' Print the concatantion string to the console:
Debug.Print (str)
' or just set the value in another cell:
Cells(10, 10).Value = str
End Sub
你能用
和
字符制作一个伪excel表格吗?类似这样的内容:ABC公司| ABC公司|……