2
Sub joint()
ActiveSheet.Range("a2", ActiveSheet.Range("a2").End(xlDown)).Select
Row = 2
col = 2
For Each Cell In Selection
country = Cells(Row, col)
Name = Cells(Row, col + 1)
honor = Cells(Row, col + 2)

Cells(Row, col + 8) = Name & ", " & country & ", " & honor

Row = Row + 1
Next
End Sub

我想以连接形式加粗名称和斜体荣誉。

例如

我的名字,朴,ABC

4

1 回答 1

4

在您的线路之后:

Cells(Row, col + 8) = Name & ", " & country & ", " & honor

添加这部分代码:

With Cells(Row, Col + 8)
    .ClearFormats
    .Characters(1, Len(Name)).Font.Bold = True
    .Characters(Len(Name) + 4 + Len(Country), Len(.Value)).Font.Italic = True
End With

其余部分保持原样。

结果截图: 在此处输入图像描述

于 2013-07-12T12:30:09.790 回答