Excel中的强制单元格会在第一列之前阻止第二列

在一个Excel行中,我想要防止数据在第一列被填写之前input到第二列。

非常感谢

您可以使用“自定义数据validation”来实现此目的。 在第二列(从B2开始)放置自定义数据validation公式:

=COUNTBLANK(A2)<=0 

这将进行testing,以确保A2在允许在B2中input任何值之前不是空白的。 希望这可以解决您的要求。

如果您更改了范围以适合您的列,下面的工作是否会对您有所帮助?

 Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 'Step 1: Check to see if Cell A1 is blank If WorksheetFunction.CountA(Sheets("enter sheet name here").Range("A11:C100")) < Sheets("enter sheet name here").Range("A11:C100").Count Then 'Step 2: Blank: cancel the Close and tell the user Cancel = True MsgBox "Cells A11 to C100 can not be blank" 'Step 3: Not Blank; Save and Close Else ActiveWorkbook.Close SaveChanges:=True End If End Sub