Need Macro Pop up for blank cells

akash.scap

New Member
Joined
Feb 8, 2011
Messages
20
Hello,

I have a sheet where specific cells are mandatory to be filled. I need a macro (pop up message) is any of the cells are left blank.

The cells mandatory to be filled are on sheet 1 - A24,A28,J24,M25...and so on

Please help
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Oh so sorry I forgot to add in the post. So basically once all the information is filled out, there is a macro that I run. If any of the field are missing then I want the pop up message. This will make the users fill out all the information and then run the macro..thank you for your help
 
Upvote 0
The easiest way would probably be to use WorksheetFunction.CountA(Your Range). I.E. If WorksheetFunction.CountA(Your Range) <> 0 Then 'Something's missing...
 
Upvote 0
Hi,

try,

Code:
Sub ISRANGEVALID(ByVal ShtName As String, ByVal RangeAddress As String)
    Dim i As Long, x
    
    x = Split(RangeAddress, ",")
    With Worksheets(CStr(ShtName))
        For i = 0 To UBound(x)
            If Application.WorksheetFunction.CountA(.Range(CStr(x(i)))) = 0 Then
                MsgBox "Fill the range " & x(i) & " to proceed", vbCritical
                Exit Sub
            End If
        Next
    End With
    
End Sub

and call the macro

Code:
Sub YourMacro()
    'First validate the range
    ISRANGEVALID "Sheet1", "A24,A28,J24,M25"
    
    'Rest of your code
    
End Sub

HTH
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,841
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top