check if the parallel cell is empty and display warning in msg box

ebineg

New Member
Joined
Feb 24, 2016
Messages
39
Hi all,

i have been working on a creating a macro to find specific name in column G and wanted to check if the the cell right to the current cell is empty. if empty warning should be displayed.

Detailed explanation:

In my sheet in column G i have enter 'A' 'B' and 'c' randomly till row 1200 like below and i wanted to check if the cells right to the 'A' and 'c" contains empty cell or not, if empty cell found message box should say "Empty cell present please fill in the details"

Column G column H
A xxx
A (empty cell)
B zzz
C yyy
B yyy
A xxx
B zzz
C (empty cell)

i have been trying to figure out solution for this and it would be great if someone can help me out. it will save me lot of time.

Thanks in advance:)
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try this code. When you run it, it will prompt for the missing entries, and will not let the user advance until they fill it out.
Code:
Sub MacroCheck()

    Dim lastRow As Long
    Dim myRow As Long
    Dim myEntry As String
    
'   Find last row in column G
    lastRow = Cells(Rows.Count, "G").End(xlUp).Row
    
'   Loop through all rows in column G starting in row 1
    For myRow = 1 To lastRow
'       Check entry in column G
        If Cells(myRow, "G") = "A" Or Cells(myRow, "G") = "C" Then
'           Check for entry in column H
            If Cells(myRow, "H") = "" Then
                Do Until Cells(myRow, "H") <> ""
                    myEntry = InputBox("Enter value to put in cell " & Cells(myRow, "H").Address(0, 0), "MISSING ENTRY!")
                    If myEntry <> "" Then Cells(myRow, "H") = myEntry
                Loop
            End If
        End If
    Next myRow
    
    MsgBox "No more missing entries.", vbOKOnly, "CHECK COMPLETE!"
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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