时间:2016-04-04 15:41 来源: 我爱IT技术网 作者:佚名
通用办法,同样类比可以获得指定行最末尾空列
前期准备工作(包括相关工具或所使用的原料等)
excel2003或wps详细的操作方法或具体步骤
新建一个vba模块

输入以下函数
Function getEmptyRow(sheetName As String, col As Long) As Long
Dim rng As Range
Set rng=ThisWorkbook.Sheets(sheetName).Cells(65536, col).End(xlUp)
getEmptyRow=rng.Row + 1
Set rng=Nothing
End Function

调用此函数
使用方法
getEmptyRow("表名",列号) 即可返回空行数值(返回值为Long)
使用举例
有一个名为 invest的表(sheet),要获得第一列的末尾空行。
在vba中写一个test()函数,调用上边函数来测试
Function test()
MsgBox getEmptyRow("invest", 1)
End Function

- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
