Excel查找下一个空白单元格并填充它 [英] Excel finding the next blank cell and populate it

查看:221
本文介绍了Excel查找下一个空白单元格并填充它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经制作了一个应用程序,该应用程序可以用几个数据填充电子表格.静态数据(始终在同一个单元格(例如"A1")中始终需要该数据)可以正常工作,并且可以实现理想效果.但是,我需要弄清楚如何使程序自动检查下一行中的单元格是否为空白.示例:

我在excel中有一个商场表,上面有数月的数据:

一月-------- 10
2月-------- 11
3月------ 21
四月
五月

现在下个月,我希望数据在四月行中显示,第二个月在五月等,我不知道如何执行此操作,我的想法是基本上说在有所需数据的空白处向下填充该列.这会工作吗?如果是这样,我该如何着手寻找空的细胞,我迷失了这个!!

为帮助加油.

Dan

Hi,

I have made an application that populates a spreadsheet with several pieces of data. The data that is static (the data is always required in the same cell e.g. "A1") is fine and works a dream. However I need to work out how to make the program automatically check if the cell on in the next row is blank. Example:

I have a mall table in excel with months and some data:

Jan--------10
Feb--------11
March------21
April
May

Now next month I want the data to go in the April row and the following month May etc I have no idea how to do this my idea was to basically say look down the column when theres a blank fill it with the required data. will this work? If so how do I set about looking for empty cells, Im lost on this one!

Cheers the help.

Dan

推荐答案

您可以使用offset属性检查下一个单元格的值.

ActiveCell.offset(row,column).Value

然后,您可以在其中绕行一些递归,以根据需要找到第一个空行/列.
You can use the offset property to check the value of the next cell.

ActiveCell.offset(row, column).Value

you can then wrap some recursion round this to find the first empty row/column as required.


我相信我已经找到了查找空白单元格的方法,现在可以放进去了循环遍历行,但对任何感兴趣的人而言.代码是:

I believe I''ve found the way to find a blank cell, now got to put it in a loop to run through rows but for anyone whose interested. the code is:

int i = 0;

while(((excel.Range)xlWorkSheet.Cells[i,"Y"].Value2 != null)
{
   i++;
}

xlWorkSHeet.get_Range("Y"+i,misValue).Value = landfill.Value;



可能会帮助别人:)



May help someone else out :)


这篇关于Excel查找下一个空白单元格并填充它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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