• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Display message boxes with if condition

Code:
Sub test()
Set EMEA = Sheets("Download_PRdata2").Columns("F").Find(What:="Files are on EMEA server, couldn't download")
    ival = Application.WorksheetFunction.CountIf(Range("F:F"), "Files are on EMEA server, couldn't download")
    If ival > 1 Then
    MsgBox "PR data files which are  Internal is completed." & vbCrLf & "There are " & Chr(34) & ival & Chr(34) & " PR data files located on at EMEA server."
    Else
    MsgBox "Download Completed."
    End If
End Sub
Want correction in above code to display one of the msg box depending on condition.
 
Hi,

The code is correct... the only change I would make is:
Code:
If ival > 0

Assuming you want to display the first message if there's at least one "Files are on EMEA server, couldn't download" in column F.
The way you have it, it will only trigger that messagebox if the count is 2 or more!
 
Last edited:
Again need help, in below code, I want to enclose F and G column in "" symbol.
Code:
Sub testyh()
Set EMEA = Sheets("Download_PRdata2").Columns("F").Find(What:="Files are on EMEA server, couldn't download")
    ival = Application.WorksheetFunction.CountIf(Range("F:F"), "Files are on EMEA server, couldn't download")
    If ival > 0 Then
    MsgBox "PR data files which are on Asia/Pacific - Internal/Export or US server Internal is completed." & vbCrLf & "There are " & Chr(34) & ival & Chr(34) & " PR data file/s located on EMEA server." & vbCrLf & "If you want them to download, search in " & Chr(34) & F & Chr(34) & " for status and use link in & Chr(34) & G & Chr(34) & column to download.", vbInformation, "PR data on EMEA server"
    Else
    MsgBox "Download Completed."
    End If
End Sub
 
Hi,

Just double down on the quotes:
Code:
MsgBox "PR data files which are on Asia/Pacific - Internal/Export or US server Internal is completed." & vbCrLf & "There are " & Chr(34) & ival & Chr(34) & " PR data file/s located on EMEA server." & vbCrLf & "If you want them to download, search in ""F"" for status and use link in ""G"" column to download.", vbInformation, "PR data on EMEA server"
 
Hi,

Just double down on the quotes:
Code:
MsgBox "PR data files which are on Asia/Pacific - Internal/Export or US server Internal is completed." & vbCrLf & "There are " & Chr(34) & ival & Chr(34) & " PR data file/s located on EMEA server." & vbCrLf & "If you want them to download, search in ""F"" for status and use link in ""G"" column to download.", vbInformation, "PR data on EMEA server"
Working!:)
 
Back
Top