vba VBA通过向左/向右移动来定位一行中出现的第一个空单元格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23764894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 03:11:31  来源:igfitidea点击:

VBA locate the first empty cell that occurs in a row by moving left/right

excelvbaexcel-vbaexcel-2010

提问by Codo

I have a Rowin Exceland many cells of that row are populated by numbers, dates, etc.

我有一个Row输入Excel,该行的许多单元格都由数字、日期等填充。

Let us say this is Row 1. However once we make a couple of moves in Row 1to the left we find 3 or 4 empty cells and then continuing our move to the left on Row 1the cells are populated again by various values.

让我们说这是Row 1。然而,一旦我们Row 1向左移动几次,我们就会发现 3 或 4 个空单元格,然后继续向左移动,Row 1这些单元格再次填充了各种值。

How can i go to the first cell which is blank and empty that occurs, when we move to the left in Row 1every time i fire up a macro?

Row 1每次启动宏时,当我们向左移动时,如何转到第一个空白的单元格?

.____.____.___.___.___.____.____.____.____.____.
|_d__|_d__|___|___|___|__x_|_d__|_d__|_d__|_O__|

To put this schematicall if we areon Ohow can we find/goto x?

为了把这个schematicall如果我们O我们如何才能找到/进入x

(Lets assume the xis the first blank cell)

(假设x是第一个空白单元格)

How can i go here enter image description here

我怎么去这里 在此处输入图片说明

采纳答案by guitarthrower

This should move the selection there.

这应该将选择移到那里。

Selection.End(xlToLeft).Offset(0,-1).Select