Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-13-2015, 09:55 AM
NoSparks NoSparks is offline need assistance in send mail macro Windows 7 64bit need assistance in send mail macro Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

You should really use Option Explicit and declare all your variables, not just some of them.
Have a look at this page.

Give this macro a try
Code:
Public Sub HighLightEmptyCells()
    Dim myRange As Range
    Dim myCell As Range
    Dim lastrow As Long
    Dim anyBlanks As Boolean
    
With ActiveSheet
    lastrow = .Cells.Find("*", .Cells(1, 1), , , xlByRows, xlPrevious).Row
    Set myRange = Application.Union(.Range("B3:D" & lastrow), .Range("F3:F" & lastrow))
    anyBlanks = False
    
    For Each myCell In myRange
        If myCell.Value = "" Then
            myCell.Interior.Color = vbRed
            anyBlanks = True
        Else
            myCell.Interior.Color = xlNone
        End If
    Next myCell
    
    If anyBlanks = True Then
        MsgBox " Please fill up Mandatory Fields Highlighted in Red"
        Exit Sub
    Else
        MsgBox "OK -- Ready to draft email"
        ' Application.Dialogs(xlDialogSendMail).Show "xyz@abc.com"
    End If
End With
End Sub
Reply With Quote
 

Tags
mail macro, validation



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code should find inv no in folder and send attachhed mail. visha_1984 Outlook 0 01-30-2013 05:08 AM
Hijacked e mail send. igardos44 Outlook 0 05-24-2012 07:32 AM
need assistance in send mail macro Send e-mail by macro plamenbv Excel Programming 1 04-16-2012 05:25 AM
Cant Send E-Mail dmack98 Outlook 0 03-09-2012 10:59 AM
need assistance in send mail macro send/receive mail every 5 min.? bsoderror Outlook 2 07-06-2009 04:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft