VBA - Moving Cells if Condition Met

Scorpion1975

New Member
Joined
Sep 4, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Dear All,
Attached herewith the recruitment tracker I am planning to prepare and implement.

There are three tables in a single sheet namely 1) Vacancy Summary 2) Recruitment Status and 3) Joining Status.

Request your help in the following:

REQUIREMENT 1 – ON BUTTON CLICK
1. In “Recruitment Status” table, if row “OFFER LETTER ISSUED ON” is filled, then
a) The position offered is to be removed from table “Vacancy Summary" and "Recruitment Status"
b) The first three columns of "Joining Status" to be updated with the positions offered.

E.g. There are four vacancies of “Sr.Lab Chemist” in the vacancy summary table. You can find that three candidates have been offered the position. By clicking the button, three lines of “Vacancy Summary” is to be removed, three lines of "Recruitment Status" to be removed and three position in the “Joining Status” table will be updated on click of the button.

RECRUITMENT STATUS TABLE
SR. NO.POSITION NAMEPROFILE DOWNLOADED ONSOURCENAME OF THE CANDIDATESPRESENT TAKE HOME SALARY (K/MONTH)PRELIM. INTERVIEW DONE ONPERSONAL INTERVIEW DONE ONSELECT / HOLD / REJECTSALARY OFFERRED (K/MONTH)OFFER LETTER ISSUED ON
1Sr. Lab Chemist01-09-2020ABCMr. XYZ ABC12302-09-2020
03-09-2020​
Reject
1234​
2Sr. Lab Chemist01-09-2020DirectMr. ABC XYZ12302-09-2020
03-09-2020​
Select
1234​
04-09-2020​

JOINING STATUS TABLE
JOINING STATUS
SR. NO.POSITION NAMENAME OF THE JOINEESDEPOSITDOCUMENTSESTIMATED DATE OF JOININGACTUAL JOINING DATE
1Sr. Lab Chemist

REQUIREMENT 2 – ON BUTTON CLICK
2. Once the “Actual Joining Date” column of “Joining Status” table is filled, then
a) Sheet 2 will be updated with relevant information on click of the button.
b) In the Sheet2, “Days Took” columns will be calculated automatically (I will put formula there). I need rest of the information to be picked from Sheet1 and pasted under relevant Columns of Sheet2.
c) The entry from “Joining Status” table to be deleted.

SHEET 2 TABLE
SR. NO.POSITION NAMEDATE OF RESIGNATIONDATE OF RELIEVINGPROFILE DOWNLOADED ONDAYS TOOK (FORMULA)PRELIM. INTERVIEW DONE ONDAYS TOOK (FORMULA)PERSONAL INTERVIEW DONE ONDAYS TOOK (FORMULA)OFFER LETTER ISSUED ONDAYS TOOK (FORMULA)JOINED ONDAYS TOOK (FORMULA)TOTAL DAYS TOOK (FORMULA)

Thank You All.

With best regards,
 

Attachments

  • Sheet 2.jpg
    Sheet 2.jpg
    252.8 KB · Views: 5

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hello,

can you supply the VACANCY SUMMARY table, and is it below the JOINING STATUS table or at the top of sheet 1?
 
Upvote 0
Top of the table...
SR. NO.POSITION NAMENEW POSITION / VACANT DUE TO RESIGNATIONDATE OF RESIGNATIONDATE OF RELEIVING OF EX-EMPLOYEE (IN CASE OF VACANT DUE TO RESIGNATION) OR DATE OF MANPOWER REQUEST (IN CASE OF NEW POSITION)
1Sr. Lab Chemist (1)Resignation01-Jan-2012-Aug-20
 
Upvote 0
Hello,

This is a bit cumbersome, but should accomplish requirement 1 a and b.

VBA Code:
Sub OFFER_LETTER_MOVE()
    Columns("K:K").Select
    Selection.Find(What:="OFFER LETTER ISSUED ON", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Activate
    TABLE_2_ROW = ActiveCell.Row
    Columns("A:A").Select
    Selection.Find(What:="JOINING STATUS", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Activate
    TABLE_3_ROW = ActiveCell.Row
    
    For MY_ROWS = TABLE_3_ROW - 1 To TABLE_2_ROW + 1 Step -1
        If Not IsEmpty(Range("K" & MY_ROWS).Value) Then
            MY_SR = Range("A" & MY_ROWS).Value
            MY_POS = Range("B" & MY_ROWS).Value
            MY_CAN = Range("E" & MY_ROWS).Value
            Range("A" & TABLE_3_ROW).End(xlDown).Offset(1, 0).Value = MY_SR
            Range("A" & TABLE_3_ROW).End(xlDown).Offset(0, 1).Value = MY_POS
            Range("A" & TABLE_3_ROW).End(xlDown).Offset(0, 2).Value = MY_CAN
            Rows(MY_ROWS).Delete
        End If
    Next MY_ROWS
    
    For MY_ROWS = TABLE_2_ROW - 1 To 2 Step -1
        If Left(Range("B" & MY_ROWS).Value, Len(MY_POS)) = MY_POS Then
            Rows(MY_ROWS).Delete
        End If
    Next MY_ROWS
End Sub

If this works as expected, can look at the second requirement. If not working post back.
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,801
Members
449,337
Latest member
BBV123

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