Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 修改我的代码以停止从空白单元格为outlook创建提醒_Excel_Vba - Fatal编程技术网

Excel 修改我的代码以停止从空白单元格为outlook创建提醒

Excel 修改我的代码以停止从空白单元格为outlook创建提醒,excel,vba,Excel,Vba,我把一行信息放在A2到G30的范围之外,用信息填充 我在1899年设置了28个提醒,但没有任何信息,因为范围是A2到G30 当运行宏为Outlook创建提醒时,我需要什么代码来忽略A2到G30或更大范围内的空白单元格 On Error Resume Next Dim i As Long Dim xRg As Range Dim xOutApp As Object Dim xOutItem As Object Set xOutApp = CreateObject

我把一行信息放在A2到G30的范围之外,用信息填充

我在1899年设置了28个提醒,但没有任何信息,因为范围是A2到G30

当运行宏为Outlook创建提醒时,我需要什么代码来忽略A2到G30或更大范围内的空白单元格

 On Error Resume Next
 Dim i As Long
    Dim xRg As Range
    Dim xOutApp As Object
    Dim xOutItem As Object
    Set xOutApp = CreateObject("Outlook.Application")
    Set xRg = Range("A2:G30")
    For i = 1 To xRg.Rows.Count
        Set xOutItem = xOutApp.createitem(1)
        Debug.Print xRg.Cells(i, 1).Value
        xOutItem.Subject = xRg.Cells(i, 1).Value
        xOutItem.Location = xRg.Cells(i, 2).Value
        xOutItem.Start = xRg.Cells(i, 3).Value
        xOutItem.Duration = xRg.Cells(i, 4).Value
        If Trim(xRg.Cells(i, 5).Value) = "" Then
            xOutItem.BusyStatus = 2
        Else
            xOutItem.BusyStatus = xRg.Cells(i, 5).Value
        End If
        If xRg.Cells(i, 6).Value > 0 Then
            xOutItem.ReminderSet = True
            xOutItem.ReminderMinutesBeforeStart = xRg.Cells(i, 6).Value
        Else
            xOutItem.ReminderSet = False
        End If
        xOutItem.Body = xRg.Cells(i, 7).Value
        xOutItem.Save
        Set xOutItem = Nothing
    Next
    Set xOutApp = Nothing
    End
End Sub

有什么建议吗

删除错误时的
“下一步继续”
-这只是隐藏错误-然后使用
IsEmpty
检查单元格是否为空。好的,建议不错。我应该把它放在哪里,怎么放?:)