判断到哪里结束应该是Excel VBA最常见的操作之一,下面代码能实现这个功能:
- Function LastColumn() As Long
- Dim ix As Long
- ix = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.Count
- LastColumn = ix
- End Function
-
-
- Function LastRow() As Long
- Dim ix As Long
- ix = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
- LastRow = ix
- End Function
-
本文转自 h2appy 51CTO博客,原文链接:http://blog.51cto.com/h2appy/825128,如需转载请自行联系原作者