单元格的值
Sub sb()
Range("b10") = Range("c2").Value
Range("b11") = Range("c2").Text
Range("c10") = "'" & Range("i3").Formula
End Sub
单元格的地址
Sub sb1()
With Range("b2").CurrentRegion
[b12] = .Address
[c12] = .Address(0, 0)
[d12] = .Address(1, 0)
[b17] = .Range("a1").Address
End With
End Sub
单元格的行列信息
单元格的格式信息。单元格的格式信息包括单元格的字体,字体颜色,背景颜色以及有没有边框
Sub sb2()
With Range("b2")
[b19] = .Font.Size
[b20] = .Font.ColorIndex
[b21] = .Interior.ColorIndex
[b22] = .Borders.LineStyle
End With
End Sub
单元格批注信息
Sub sb3()
[b24] = Range("i2").commont.Text
End Sub
单元格的位置信息
Sub sb4()
With Range("b3")
[b26] = .Top
[b27] = .Left
[b28] = .Height
[b29] = .Width
End With
End Sub
单元格的上级信息
Sub sb5()
With [b3]
[b31] = .Parent.Name ‘查询b3所在的sheet名称
[b32] = .Parent.Parent.Name ’查询workbook名称
End With
End Sub
内容判断
Sub sb6()
With [i3]
[b34] = .HasFormula ‘i3是否有公式
[b35] = .Hyperlinks.Count ’单元格是否有超链接
End With
End Sub
单元格数据类型(另讲)