I would like a code which run through all tables in the different worksheets of my spreadsheet and deletes a row if it contains a the value LeaverName and PositionLeaver in column 1 and 2.
Also if it could return the name of the worksheet where the row has been deleted.
My code is the following atm:
Sub Leavers()
Dim LeaverName As String
LeaverName = InputBox("Enter name of the employee leaving in the following format (Surname, First Name)", "Adding New Joiner to Hub")
Dim PositionLeaver As String
Position = InputBox("Enter new joiner Position (A, C, SC, PC, MP, Partner, Admin, Analyst, Director)", "Assigning New Joiner to a position")
'Input Name and Position of the employeee leaving and stores it (Could be improved with user form...)
Dim tbl As ListObject
Dim sht As Worksheet
Dim MyTable As ListObject
'Loop through each sheet and table in the workbook
For Each sht In ThisWorkbook.Worksheets
For Each tbl In sht.ListObjects 'loop through all tables
'To omit certain tables you can do the below
If tbl.Name <> "Table2" And tbl.Name <> "Table3" And tbl.Name <> "Table5" And tbl.Name <> "Table7" _
And tbl.Name <> "Table9" And tbl.Name <> "Table11" And tbl.Name <> "Table13" And tbl.Name <> "Table15" Then ...
At this point, I am not too sure how to approache the problem.
Thanks Guys !