簡單問題,請幫忙解答,謝謝1.怎樣設定單元格文字的對齊方式(居左,居右,居中)
2.怎樣設置單元格文字的格式為字符串,因為某些數值Excel默認會轉換為特殊格式
比如3.00E2這個字符串就無法正常顯示
3.如何設置背景色
4.".Cells(1,1).Style"屬性怎樣設置
2.怎樣設置單元格文字的格式為字符串,因為某些數值Excel默認會轉換為特殊格式
比如3.00E2這個字符串就無法正常顯示
3.如何設置背景色
4.".Cells(1,1).Style"屬性怎樣設置
调试欢乐多
用 .HorizontalAlignment = xlLeft
xlRight
xlCenter
2.改單元格的格式為字符串型
如可改 C4 單元格的類型
用 .Range("C4").Select
再 .Selection.NumberFormatLocal = "@"
3.背景色
.Selection.Interior.Color = RGB(0, 0, 255)
前景色
.Selection.Font.Color = RGB(0, 0, 255)
4.比如我選中B2這個單元格,在裡面輸入一個數字1024,然後把此單元格的類型改為字符串型,再改字體
.Range("B2").Select
.ActiveCell.FormulaR1C1 = "1024"
.Selection.NumberFormatLocal = "@"
With .Selection.Font
.Name = "新細明體"
.FontStyle = "標準"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
5.再送你一個常用的合並單元格,先選中要合並的單元格然後
.Selection.Merge
Range("A1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
设置单元格为文本样式
Range("A2").Select
Selection.NumberFormatLocal = "@"
设置单元格颜色背景
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
NumberFormatLocal屬性可以取哪些值或者說有沒有此方面的文檔(Word,Excel Application的方法和屬性,找MSDN畢竟麻煩.
謝謝