How to find the first empty cell in a row starting at column I3. Search will occur only in the first line.
1 answer
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
|