zoukankan      html  css  js  c++  java
  • Excle中range的一些用法

    以下是一些range的简单用法

    Sub aa()
    '-===============================================
     '给B列设置填充颜色为黄色
     Range("B:B").Select
     With Selection.Interior
     .Color = 65535
     End With
     '给A1录入"我是孙悟空"
     Range("A1").Select
     ActiveCell.FormulaR1C1 = "我是孙悟空"
     
     '--==============================================
     '不相邻区域,使用,表示加选 设置颜色为黑色
     Range("F13:G14,I13:I14").Select
     With Selection.Interior
     .Color = 15
     End With
     
     '--==============================================
    '不相邻区域,空格的话表示2个区域相交,设置为绿色
     Range("K14:K21,K18:M21").Select
     With Selection.Interior
     .Color = 5287936
     End With
     
     '--==============================================
     '单元格的相对引用写法 设置为橙色
     Range("F4:G8").Range("a1").Select
     With Selection.Interior
     .ThemeColor = xlThemeColorAccent6
     End With
     
     '--==============================================
     'range的变量支持
     Dim s%
     s = 3
     Range("A" & s).Select
     Range("c3:e5")(2).Select
     With Selection.Interior
    .ThemeColor = xlThemeColorLight2
     End With
     
     ActiveWorkbook.Save '保存
    End Sub

    在EXCLE中运行后截图如下:

  • 相关阅读:
    启发式搜索学习~~
    bzoj1032
    bzoj1037
    bzoj1029
    codevs1081 线段树练习 2
    bzoj1006
    bzoj1003
    Codeforces 607B Zuma
    20155326《网络对抗》网络欺诈技术防范
    20155326刘美岑 Exp6 信息收集与漏洞扫描
  • 原文地址:https://www.cnblogs.com/OliverQin/p/6198441.html
Copyright © 2011-2022 走看看