Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Looking for coding that checks if cell is empty or not. If it is not empty then move to the next cell group. But I need to check if the next cell group is empty or not. If not, then move to the next and so on.

My Current coding below.

If IsEmpty(ActiveSheet.Range("h3")) Then
    Do
    Checkbox1.Value = True
    Range("H3") = 17002
    Sheets("Sheet1").Range("I3") = Printerformat2.Text
Else
    Checkbox1.Value = True
    Range("l3") = 17002
    Sheets("Sheet1").Range("m3") = Printerformat2.Text
End If
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
160 views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to use a for loop to iterate through the specified range in "H"

Dim i As Long
With ActiveSheet
  For i = 1 to 500

    If IsEmpty(.Range("h" & CStr(i)).Value) Then
     'Do 'Not sure where you're going with this one? This is not really needed from what I can tell.
     Checkbox1.Value = True
     .Range("H" & CStr(i)).Value = 17002
     Sheets("Sheet1").Range("I" & CStr(i)).Value = Printerformat2.Text
    Else
      Checkbox1.Value = True
      .Range("l" & CStr(i)) = 17002
      Sheets("Sheet1").Range("m" & CStr(i)).value = Printerformat2.Text
    End If

   Next
End With

Hope that helps?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...