我需要有一个工作表根据是否有文本数据列K中自动插入一行

这是我试过的。 它工作,但不能自动工作。 你必须运行macros才能使其工作。 我需要它在input数据时工作。

Sub BlankLine() Dim Col As Variant Dim BlankRows As Long Dim LastRow As Long Dim R As Long Dim StartRow As Long Col = "K" StartRow = 1 BlankRows = 1 LastRow = Cells(Rows.Count, Col).End(xlUp).Row Application.ScreenUpdating = False With ActiveSheet For R = LastRow To StartRow + 1 Step -1 If .Cells(R, Col) <> "" Then .Cells(R + 1, Col).EntireRow.Insert Shift:=xlDown End If Next R End With Application.ScreenUpdating = True End Sub