2009-12-10 72 views

回答

3

未經測試:

Dim row As Long 
Dim col As Long 

col = 4  ' Whatever column you want to check 

For row = 1 To 100  ' How many rows you want to check 
    If Not IsNumeric(Cells(row, col).Value) Then 
     ' Do whatever you want to do in this case 
    End If 
Next row 

如果你澄清你的意思是「插入一個空白單元格中的問題能排」,我會嘗試更新我的解決方案。

+0

TNX,插入一個新的空白單元格前面的非數字一個 – Tom 2009-12-10 14:27:36

+0

所以,你要非數字的單元格一個位置移動到右邊,並在原處插入一個空白單元格?或者只是清除非數字左邊的單元格? – Heinzi 2009-12-10 14:35:40

+1

提示:整數太小而無法用於行計數器嘗試使用Long來防止溢出。 – Oorang 2009-12-11 13:12:53

0

您可以檢查甚至與列不包含任何無號碼一個forumla只檢查

=COUNTBLANK(AAA:AAA)-COUNTBLANK(B:B)=COUNT(B:B) 

,我認爲列AAA:AAA是空的。

0

混合其他答案以獲取更大的數據。 它首先檢查colomn是否只有數字,如果沒有,檢查位置。

Dim row As Long 
Dim LastRow As Long 
LastRow = Range("B" & Rows.Count).End(xlUp).Row 'if you want the colomn B 

If Excel.WorksheetFunction.CountBlank(Range("AAA:AAA")) - Excel.WorksheetFunction.CountBlank(Range("B:B")) = Excel.WorksheetFunction.Count(Range("B:B")) Then 
For row = 1 To LastRow  

    If Not IsNumeric(Range("B" & row).Value) Then 
     ' Do whatever you want to do in this case 
    End If 
Next row 
End if