Fill empty cells in VBA

Solved
Brutalizer Posted messages 2 Status Member -  
Brutalizer Posted messages 2 Status Member -
Hello everyone,

Since I’m not very familiar yet with the VBA language, I’m turning to you. I’m looking for the VBA code that will allow me to add a letter, in this case the letter "C", to my Excel file. As you can see from my printscreen, I also have empty cells. These "C" letters should therefore be entered wherever the cell on the left is not empty. Do you have any idea?

Many thanks!

1 answer

  1. WeaponEDGE Posted messages 114 Status Member 9
     
    Hello, First, compute the number of rows in your table based on column I with this code:
    Nb_Ligne = Cells(Rows.Count, 9).End(xlUp).Row
    Then use the following loop:
    For i = 2 To Nb_Ligne
        If Cells(i, 9) <> "" Then
            Cells(i, 10) = "C"
        End If
    Next i
    0
    1. Brutalizer Posted messages 2 Status Member
       
      Excellent! Thank you so much!
      0