vba 单元格 一系例操作

 

1.单元格取值赋值

Private Sub CommandButton1_Click()
Range(
"A1"= "111"
Range(
"A2").Value = "2222"
Range(
"A10"= Range("A1")
Range(
"A11"= Cells(21).Value
Range(
"A12"= Cells(21)

Range("A13").ClearContents         '清除内容

 

 

Range("a20").Formula = "=rand()"  '单无格公式

End Sub

 

2.单元格设置颜色

Cells(11).Interior.ColorIndex = 3 '单无格的颜色   

         

posted @ 2008-08-03 22:01  Ewin  阅读(1192)  评论(0编辑  收藏  举报