Modify Code

josros60

Registered User.
Local time
Today, 10:47
Joined
Mar 10, 2011
Messages
73
how can i change the message line of this code to display no only column c details but also column "D" and "E" and popup dialog.

Here it's the code:

Code:
Dim lstRow As Long
Dim i As Long
Dim msg As String
msg = "Alert!!! The following schedules need attention, payment will be due soon:" & vbCrLf & vbCrLf
lstRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 4 To lstRow
    If Range("A" & i) - Date <= 3 Or Range("A" & i) - Date < 0 Then
        [B]msg = msg & Range("C" & i).Value & " : Scheduled in " & Range("A" & i) - Date & " Days" & vbCrLf[/B]

Thanks
 
On A4 todays date was added, on A5 tomorrows date, A6 the day after tomorrow, .... A29 28 Days Later (opps, movie name rights violation)
Just small changes to your code, this ran just fine.

Highly recommend you add
Option Explicit
to the very first line of code.
Then use the Debug - Compile
There is a setting in the code module to always include Option Explicit automatically to the beginning of any code module.

Code:
 Sub TestRx_CustomerExperience()
Dim lstRow As Long
Dim i As Long
Dim msg As String
On Error GoTo InterrigationRoom
    msg = "Alert!!! The following schedules need attention, payment will be due soon:" & vbCrLf & vbCrLf
    lstRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 4 To lstRow
    If Range("A" & i) - Date <= 3 Then
        msg = msg & Range("C" & i).Value & " : Scheduled in " & Range("A" & i) - Date & " Days"
        MsgBox msg, vbCritical, "Hey bonehead, this date is wacked!"
    End If
Next
Exit Sub
InterrigationRoom:
    ' NO, NO, not Room 101!
      Debug.Print "Error " & Err.Description &  "  How many fingers am I holding up?"
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom