返回列表 上一主題 發帖

[發問] 如何把多个MsgBox的讯息放在一个对话框?

'試試看:
'但 MsgBox 字數有限制, 一次不能裝太多!!
'能裝多少我不清楚!!
'如果裝不下, 就要分段顯示.
Private Sub Workbook_Open()
Dim xT As String
With Sheet1
    For i = 2 To .UsedRange.Rows.Count + 1
        If .Cells(i, 8) = "PENDING" Then
            If ("0" < .Cells(i, 7)) And (.Cells(i, 7) < "4") Then
                xT = xT & (.Cells(i, 3) & " Still have" & .Cells(i, 7) & "days!!! PLEASE UPDATE. ") & Chr(10)
            ElseIf ((.Cells(i, 7)) < "1") Then
                xT = xT & (.Cells(i, 3) & " Still not arrive!!!!! PLEASE FOLLOW UP. ") & Chr(10)
            End If
        End If
    Next i
    MsgBox xT
End With
End Sub

TOP

這是根據准大的建議所做的修正:
試試看:
Private Sub Workbook_Open()
Dim I As Integer
With Sheet1
    For I = 2 To .UsedRange.Rows.Count + 1
        If .Cells(I, 8) = "PENDING" Then
            If ("0" < .Cells(I, 7)) And (.Cells(I, 7) < "4") Then
                 .Cells(I, 3).Interior.ColorIndex = 36
            ElseIf ((.Cells(I, 7)) < "1") Then
                 .Cells(I, 3).Interior.ColorIndex = 38
            End If
        End If
    Next I
End With
End Sub

TOP

        靜思自在 : 【是否發揮了良能?】人間壽命因為短暫,才更顯得珍貴。難得來一趟人間,應問是否為人間發揮了自己的良能,而不要一味求長壽。
返回列表 上一主題