Excel vba語法怎麼設定字型?.Font
原來range("a1:a5"),跟range(cells(1,1),cells(5,1))是有差別的
Sheets("1").Select
Set tmpRng = Range(Cells(1, 2), Cells(5, 1))
myRng = tmpRng.Address
Set myRng = Sheets("2").Range(myRng)
這樣也OK,是因為是range 跟 cells也會出問題
設定字型如下
With Sheets(st).Range(myRng)
.Orientation = 90
End With
With Sheets(st).Range(myRng).Font
.Name = "新細明體"
.FontStyle = "標準"
.Size = 16
End With
With Sheets(st).Range(myRng).Interior
.ThemeColor = xlThemeColorLight2
End With
Sheets("1").Select
Set tmpRng = Range(Cells(1, 2), Cells(5, 1))
myRng = tmpRng.Address
Set myRng = Sheets("2").Range(myRng)
這樣也OK,是因為是range 跟 cells也會出問題
設定字型如下
With Sheets(st).Range(myRng)
.Orientation = 90
End With
With Sheets(st).Range(myRng).Font
.Name = "新細明體"
.FontStyle = "標準"
.Size = 16
End With
With Sheets(st).Range(myRng).Interior
.ThemeColor = xlThemeColorLight2
End With
留言
張貼留言