excel vba 快速获取某工作表最后行数(首列不为空值)
2020-02-18 06:48
573 查看
Function getlastcell(mysheet As String, Optional startrow As Integer) As Integer
Sheets(mysheet).Select
rowcountinu = False
If startrow = 0 Then
startrow = 2
End If
For i = startrow To startrow + 2000
If Trim(Cells(i, 1).Text) = "" Then
getlastcell = i
rowcountinu = False
Exit Function
End If
Next
rowcountinu = True
getlastcell = i - 1 '临时方法,用2000作为分界和首次未结束标记
End Function
Sheets(mysheet).Select
rowcountinu = False
If startrow = 0 Then
startrow = 2
End If
For i = startrow To startrow + 2000
If Trim(Cells(i, 1).Text) = "" Then
getlastcell = i
rowcountinu = False
Exit Function
End If
Next
rowcountinu = True
getlastcell = i - 1 '临时方法,用2000作为分界和首次未结束标记
End Function
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- VB 通过进程PID获取该程序的窗口句柄函数
- VB 通过进程PID获取该程序的窗口句柄函数
- VB 中自定义弹出提示框的位置
- VBA,两个sheet根据 4000 第一列id相同比较其余列,不同的值放到sheet3中
- solaris vbs巡检脚本
- vb的LINQ实现
- VB.NET 使用CHART控件做实时曲线
- VB总结
- 用VB制作文件下载程序(转)
- LGT8F328P-SSOP20 MiniEVB与USB--TTL烧录器连接
- VB调用.NET DLL(一)
- VB.NET水晶报表Crystal Reports学习(开发环境安装+程序示例+报表示例+客户端运行环境)
- 【求助】如何将循环检测中的代码检测到后只循环一次(vbs语言)
- VB6.0的DllFunctionCall
- VB程序中如何找到自定义函数
- VB 获取 Internet Explorer_Server 里面的内容
- VB钓鱼
- VB语言入门学习
- VBA编程实现汉字注音
- C# params VB.NET ParamArray