VB 2010,测试空的Excel单元格 [英] VB 2010, testing for empty Excel cells

查看:101
本文介绍了VB 2010,测试空的Excel单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[由谷歌翻译]



大家好,我有问题。我有一个程序需要从Excel电子表格中读取值,除了空白单元格我没有问题,事实上,不知道有多少行,我想到了一个循环来找到第一个空行但是我vb在我发布有问题的代码时会产生错误,肯定会是一个让我失望的废话。

谢谢大家的帮助。




[原帖]

Salve a tutti,avrei un problemino。 ho un programma che deve leggere dei valori da un foglio di Excel,non ho problemi tranne per le celle vuote,infatti non sapendo quante righe ci sono,ho pensato ad un ciclo per individuare la prima riga vuota ma vb mi genera un errore,sotto vi posto il codice incriminato,sicuramentesaràunacavolata che mi sfugge。

Grazie a tutti per l'aiuto。



[translated by google]

Hi all, I have a problem. I have a program that needs to read values ​​from an Excel spreadsheet, I have no problems except for blank cells, in fact, not knowing how many rows there are, I thought of a loop to find the first empty row but I vb generates an error under I'll post the offending code, surely will be a bullshit that escapes me.
Thank you all for the help.


[original post]
Salve a tutti, avrei un problemino. ho un programma che deve leggere dei valori da un foglio di Excel, non ho problemi tranne per le celle vuote, infatti non sapendo quante righe ci sono, ho pensato ad un ciclo per individuare la prima riga vuota ma vb mi genera un errore, sotto vi posto il codice incriminato, sicuramente sarà una cavolata che mi sfugge.
Grazie a tutti per l'aiuto.

While FoglioExcel.Cells(I, 1).value.tostring <> ""
    NumRigheFoglio = NumRigheFoglio + 1
    I = I + 1
End While





grazie



grazie

推荐答案

您应该使用(只是一个猜测,因为您没有报告确切的错误消息):

You should probably use (is just a guess, since you did not report the exact error message):
While Not FoglioExcel.Cells(I, 1).Value Is Nothing


这篇关于VB 2010,测试空的Excel单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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