每个单元格的空白提示用户输入搜索范围

Search Range If Blank Prompt User Intup per cell

我有一系列信息,想在保存之前检查一下。我在提示用户哪个单元格为空白然后提示他们输入正确信息的方程式时遇到问题。我认为这是因为我将单元格定义为一个范围或者我遗漏了其他东西。输入框弹出后,我试图通过将单元格偏移到左侧来通知用户他们丢失了哪些数据。左边的单元格是他们需要输入的数据类型(如日期或姓名)。该偏移单元格也不会显示在输入框的消息中。

For Each CheckCell In Sheets("Sheet1").Range("J5:J17").Cells
        If Len(Trim(CheckCell.Value)) = 0 Then
           Cellcheck.Value = Application.InputBox("Please Enter Data for" & CheckCell.Offset(Rowoffset:=0, Columnoffset:=-1).Value, "Mission Info")
        End If
    Next CheckCell

你的第三行应该是 CheckCell.Value...,而不是 Cellcheck.Value...:

For Each CheckCell In Sheets("Sheet1").Range("J5:J17").Cells
    If Len(Trim(CheckCell.Value)) = 0 Then
       CheckCell.Value = Application.InputBox("Please Enter Data for " & CheckCell.Offset(Rowoffset:=0, Columnoffset:=-1).Value, "Mission Info")
    End If
Next CheckCell

更正拼写错误

Sub dural()
    For Each checkCell In Sheets("Sheet1").Range("J5:J17").Cells
        If Len(Trim(checkCell.Value)) = 0 Then
           mesage = "Please Enter Data for " & checkCell.Address(0, 0)
           checkCell.Value = Application.InputBox(Prompt:=mesage, Type:=1)
        End If
    Next checkCell
End Sub

更改类型以满足您的要求。