【Excel VBA】properties & methods of RANGE
SpecialCells:
find special cells 指定类型查找
1. To find the end of a range
- find the last row
- 适用于range中间没有空行,End(xlDown)相当于ctrl + down,直接拉到Range最底下
- Row => get the number of row
-
another way to find the last row
从整个表的最后一行jump back
Rows.Count => find how many rows in the worksheet -
find next empty cell
-
find the last column
-
current region
current region的地址
current region有多少行 -
special cells
special cells有很多种选项:
2. Copy & paste method
-
copy everything
Range(要复制的区域).copy.range(要粘贴的区域) -
special copy
先copy当前region
和special cell一样,可以选要paste哪些内容 -
resize
先offset一行,就是把header去掉,但是整个表的row也要减去一行
-
Cuting mode = false
copy和paste分开时,原区域仍然会被选中
copy mode例子
3. reference worksheet
为什么不能用active sheet?
因为在VBA中,active sheet被当作一个object, 但又不是特定的object, 所以没有intelliSense
方法1:
新建一个variable (sh),将sh归入Worksheet类,然后再赋值为active sheet
方法2:
如果要指定特定的表,可以用表名,最好用code name(在VBE中才能看到,不会被随意修改)
code name可以在properties中修改
4. Reference workbook
debug.print 将VBA在immediate窗口运行,用于调试
- Microsoft.XMLDOM(XMLDOM)对象的属性和方法(Methods and properties of Microsoft.XMLDOM)
- Javascript Object Method Properties console.log View all methods and properties of the object
- Microsoft.XMLDOM(XMLDOM)对象的属性和方法(Methods and properties of Microsoft.XMLDOM)
- android release build error: String index out of range: -125
- Spark streaming kafka OffsetOutOfRangeException 异常分析与解决
- c++ Expression: string subscript out of range
- [LeetCode] Count of Range Sum 区间和计数
- System.ArgumentOutOfRangeException: 年、月和日参数描述无法表示的 DateTime。
- Comparative analysis of methods for detecting interacting loci
- Crystal Clear Applied: The Seven Properties of Running an Agile Project (转载)
- Using a palette from .NET to display properties of multiple AutoCAD objects
- Factory methods are static methods that return an instance of the native class(保护CONSTRUCTOR)
- Application Range and Value of Impact Crusher
- 解决UIColor设置值溢出的警告(UIColorBreakForOutOfRangeColorComponents)
- OC学习:可变字符串替代:replaceOccurrencesOfString:(NSString *) withString:(NSString *) options: range:方法
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans
- Practical Methods of Optimization _书评转载
- Data truncation: Out of range value
- Calculating the Range of Addresses on Your Network
- leetcode笔记:Bitwise AND of Numbers Range