Private Sub Worksheet_Change(ByVal Target As Range)
Dim lastRow As Long
Dim i As Long
Dim seq As Long
' B열에서만 작동
If Intersect(Target, Me.Columns("B")) Is Nothing Then Exit Sub
Application.EnableEvents = False
lastRow = Cells(Rows.Count, "B").End(xlUp).Row
seq = 1
For i = 2 To lastRow ' 2행부터 (헤더 제외)
If Cells(i, "B").Value <> "" Then
' 숫자 또는 영어 포함 여부 체크
If Cells(i, "B").Value Like "*[0-9A-Za-z]*" Then
Cells(i, "A").Value = seq
seq = seq + 1
Else
Cells(i, "A").ClearContents
End If
Else
Cells(i, "A").ClearContents
End If
Next i
Application.EnableEvents = True
End Sub