2013-07-12 79 views
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 

我想以连接形式大胆地命名和斜体表示荣誉。以粗体和斜体连接不同的单元格excel vba

例如

MYNAME,小唐,ABC

回答

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 

并保持那里就这样。结果

屏幕截图: enter image description here

+0

我尝试过,但结果没有产生。谢谢 –

+0

但是有什么问题?有什么错误?哪一行和多少? –

+0

哦,它工作正常。没问题。我在说我也试过了,但没有得到结果 –

相关问题