nabilah
nabilah

Reputation: 211

Insert Dates when empty cells are found in a column

Hi currently i have a code that allows me to insert the rows of specific dates in excel. However now i would need a code that would allow me to insert the specific date in a column where there is an empty cell. The code that i have so far is:

 Sub Update()

    For Each cell In Range("B2:B318")
        cell.Value = "9 / 4 / 2015"

    Next

End Sub

I am not sure of making the necessary changes to allow the code to look through column B from row 2 to row 318 and insert the specific dates on any empty cell found. I hope anyone could assist me. Would appreciate it a lot. Thank you.

Upvotes: 2

Views: 455

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

Test each cell:

  Sub Update()

    For Each cell In Range("B2:B318")
      If cell.Value = "" Then
        cell.Value = "9 / 4 / 2015"
      End If
    Next

End Sub

Upvotes: 1

Related Questions