compare a cell with nothing
i am sorry about my english.
I am trying to write a vba code to insert some text in an array of cells (as is show below).
There are 2 steps:
1 - i want find if in a certain cell is empty, and if the cell is empty to write something in that cell and stop the private sub.
2- if that cell have a text i want to go to the next cell and do again 1st step
i try this but doesn't work.
Private Sub CommandButton16_Click()
Dim i As Integer
For i = 28 To 33 Step 1
If Cells(i, 1) = "" Then Cells(28, 1) = "SO2": GoTo 10
If Cells(i, 2) = "" Then Cells(28, 1) = "SO2": GoTo 10
If Cells(i, 4) = "" Then Cells(28, 1) = "SO2": GoTo 10
If Cells(i, 7) = "" Then Cells(28, 1) = "SO2": GoTo 10
If Cells(i, 8) = "" Then Cells(28, 1) = "SO2": GoTo 10
If Cells(i, 9) = "" Then Cells(28, 1) = "SO2": GoTo 10
If Cells(i, 10) = "" Then Cells(28, 1) = "SO2": GoTo 10
Next
10 End Sub
i hope is clear what i want.
thanq!
|