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
我希望以连续的形式加粗名称和斜体。
例如
myname ,pak, ABC
答案 0 :(得分: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
并保持原样。
结果的屏幕截图: