Macros script Excel, filling in blanks with NULLS, error 400
All i'm trying to do is fill in NULL in the cells that are blank.
source code:
Sub fillNULLs()
Dim count As Int开发者_StackOverflow中文版eger
count = 0
Dim col As Integer
col = 2
While count < 23403
If (Cells(count, col) = "") Then
Cells(count, col) = "Null"
End If
count = count + 1
Wend
End Sub
I run the macros and i get a 400 and an okay button. Can anyone spot the issue
Sub fillNULLs()
Dim a, b As Range
Set a = Range("B1:B23402")
For Each b In a
If (Trim(b.Value) = "") Then b = Null
Next b
End Sub
Edit
To check it is doing what it must do
Sub fillNULLs()
Dim a, b As Range
Set a = Range("B1:B23402")
For Each b In a
If (Trim(b.Value) = "") Then b = "Null"
Next b
End Sub
You will see "Null" in the modified values.
I guess that count should be 1 at first before While loop
精彩评论