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中运行后截图如下:

  • 相关阅读:
    java线程池及创建多少线程合适
    消息队列消息积压了怎么办?
    Redis线程模型
    redis单线程如何支持高并发
    基于redis实现分布式锁
    PHP面试总结
    【转】Redis入门
    面试常考之二叉树
    计算机网络之面试常考
    操作系统之面试常考
  • 原文地址:https://www.cnblogs.com/OliverQin/p/6198441.html
Copyright © 2011-2022 走看看