How to find the first empty cell in a row starting at column I3. Search will occur only in the first line.

  • Specify which cell: at the end of the data or empty among the data? Describe the question in more detail. - vikttur
  • Empty data cell - Kernel Panic

1 answer 1

Dim lClmn As Long With ActiveSheet lClmn = .Cells(1, .Columns.Count).End(xlToLeft).Column + 1 

The rightmost empty cell in row 1 is written to the variable.

Among the data, the void can be found using the loop

 Sub FindEmpty() Dim lClmn As Long, j As Long lClmn = Cells(1, Columns.Count).End(xlToLeft).Column + 1 ' первый пустой после данных в строке 1 If lClmn < 9 Then Exit Sub For j = 9 To lClmn ' начало поиска со столбца I If Cells(1, j).Value = "" Then Exit For Next j MsgBox j ' сообщение с номером столбца End Sub 

If there are no empty cells among the data, the message will indicate the number of the first column after the data range

  • .Cells here really need a point in front of Cells and Columns? - Kernel Panic
  • Point is set if parent is specified. Without parent, the links refer to the active sheet - vikttur
  • It is clear, thank you very much. - Kernel Panic