给定行中的最后一个非空单元格(列); Excel VBA [英] Last not empty cell (column) in the given row; Excel VBA

查看:205
本文介绍了给定行中的最后一个非空单元格(列); Excel VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张excel工作表,需要在特定行中找到最后一个非空单元格.

I have an excel sheet in which I need to find the last non empty cell in a specific row.

我该怎么做?

下面将为我选择此项,但它将选择第一个非空单元格,我需要在第29行中的最后一个非空单元格.

The below will select this for me, but it will select the first not empty cell, I need the last not empty cell in the row #29.

Worksheets("DTCs").Range("A29").End(xlToRight).Select

推荐答案

我认为它可能只是从另一个方向进行搜索,所以类似:

I think it might work just search from the other direction, so something like:

Worksheets("DTCs").Range("IV29").End(xlToLeft).Select

尽管根据Excel的版本,IV可能需要更改为其他名称(这似乎在2003年可用).

Though maybe the IV would need to be changed to something else depending on the version of Excel (this seems to work in 2003).

这篇关于给定行中的最后一个非空单元格(列); Excel VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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