2013-07-12 85 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

哦,它工作正常。沒問題。我在說我也試過了,但沒有得到結果 –

相關問題