用粗体和斜体连接不同的单元格excel vba
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
我想大胆地命名和连接forms的斜体。
例如
myname ,pak, ABC
紧跟你的路线:
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
保持原状。
结果屏幕截图: