拖动列VBA的最后一个值

时间:2022-10-28 16:29:42

I reviewed all topics and I can't find an answer to this problem I have.

我查看了所有主题,但我找不到这个问题的答案。

I have four rows from which I have to take data daily for different files and update information. I have the code topy the information but I was wondering how to tell in VBA to go to the column in that row with a value on it... something like this:

我有四行,每天我必须为不同的文件获取数据并更新信息。我有代码topy信息,但我想知道如何告诉VBA转到该行中的列与值...这样的事情:

    Range("CE4").Select
    Selection.End(xlToRight).Select

But then, how can I request that it moves one space to the right? Thanks in advance.

但是,我怎么能要求它向右移动一个空格?提前致谢。

1 个解决方案

#1


You could use offset to do this:

您可以使用offset来执行此操作:

Range("CE4").Select
Selection.End(xlToRight).Offset(0,1).Select

Or more succinctly:

或者更简洁:

Range("CE4").End(xlToRight).Offset(0,1).Select

Offset will will move the number of rows and columns, respectively, from the range specified.

偏移量将分别从指定的范围移动行数和列数。

#1


You could use offset to do this:

您可以使用offset来执行此操作:

Range("CE4").Select
Selection.End(xlToRight).Offset(0,1).Select

Or more succinctly:

或者更简洁:

Range("CE4").End(xlToRight).Offset(0,1).Select

Offset will will move the number of rows and columns, respectively, from the range specified.

偏移量将分别从指定的范围移动行数和列数。