在VBA中找到Excel工作表的底部 [英] Find bottom of Excel worksheet in VBA

查看:353
本文介绍了在VBA中找到Excel工作表的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想选择工作表的底部,但不能低于使用/存储的内容。我可能有10,000行,但我当然没有65,536。我不会提前知道多少行。

I'd like to select to the bottom of the worksheet, but not below what is used/stored. I might have 10,000 rows, but I certainly don't have 65,536. I won't know ahead of time how many rows.

在Excel本身(在最近的版本中,无论如何,Excel 97不是那么好)你可以按Ctrl +结束到最后一行和第列。我想要相同的功能。

In Excel itself (in recent versions, anyway; Excel 97 wasn't so kind) you can press Ctrl + End to be taken to the last row and column. I'd like the same functionality.

推荐答案

最简单的方法是从底部开始,找到最后一行包含一些东西:

范围(a65536)。end(xlup).row

The simplest way is to start at the bottom and work up to find the last row that contains something:
Range("a65536").end(xlup).row

这篇关于在VBA中找到Excel工作表的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆