VBA - Check if exists in Specific column values other than wanted and macro to proceed forward

Myproblem

Board Regular
Joined
May 24, 2010
Messages
198
I need to check if there is in specific column (column C) values other than wanted, like if there is any employees that are not on our´s company payment list.
If there is no employees that are not on our´s company payment list msg box should return some message like "It is OK, would you like to proceed with macro?", and Cancel, OK and
in case that there is employees that are not on our´s company payment list msg box should names of employees with info about sum of their payments (values of payments are in column D).
In the case there is some sum in column D with criterias named above different than 0, msg box should return warnings to "Modify table" and in case that sum in column D with criterias named above equal 0, msg box should return question "Would you like to delete these rows?".

List of employees should be part of code, like array if it is possible.

I have been searching web forums about similar situation, but there is no complete solution.
For now I only manage to figure out how to delete rows if there is some specific values. It is below, but I think I am stuck and having trouble to figure out efficient solution for this
any idea, tips, solutions - thanks in advance
Code:
Public Sub Delete_row_X()</SPAN>
    
    Dim Last_Row As Long</SPAN>
    Dim iLoop As Long</SPAN>
    
    Last_Row = ActiveSheet.Range("A100000").End(xlUp).Row + 1</SPAN>
    
    For iLoop = Last_Row To 1 Step -1</SPAN>
        If (Trim(ActiveSheet.Cells(iLoop, 3).Value) = "James") And (Trim(ActiveSheet.Cells(iLoop, 14).Value) = "0") Then</SPAN>
            ActiveSheet.Cells(iLoop, 14).EntireRow.Delete</SPAN>
        End If</SPAN>
    Next iLoop</SPAN>
    
End Sub</SPAN>
 
Public Sub Delete_row_Huan()</SPAN>
    
    Dim Last_Row As Long</SPAN>
    Dim iLoop As Long</SPAN>
    
    Last_Row = ActiveSheet.Range("A100000").End(xlUp).Row + 1</SPAN>
    
    For iLoop = Last_Row To 1 Step -1</SPAN>
        If (Trim(ActiveSheet.Cells(iLoop, 3).Value) = "Huan") And (Trim(ActiveSheet.Cells(iLoop, 14).Value) = "0") Then</SPAN>
            ActiveSheet.Cells(iLoop, 14).EntireRow.Delete</SPAN>
        End If</SPAN>
    Next iLoop</SPAN>
    
End Sub</SPAN>
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,217,413
Messages
6,136,474
Members
450,015
Latest member
excel_beta_345User

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