Microsoft Excel – Need a recommendation to change my vba code to be more efficient

WARNING: Please do not proceed if you have no vba experience.

Objective: Transfer the second column of Test Sheet 1 to the second column of the test sheet.

Or:

For each CPU in Test1. If the name of the CPU in the Test1 sheet matches the name of the CPU in the TestS sheet, copy the 2nd column of that CPU into Test1 and paste it into the 2nd column of this CPU in TestS.

Otherwise, create a new line with the name of the PU not found and the 2nd column after the last CPU of the TestS sheet.

The final look in TestS looks like: TestS

This is my current code that works:

            Dim noofComps As Long
noOfComps = Worksheets ("Test1"). Range ("A1"). CurrentRegion.Rows.Count-1
Dim x as long
x = 0
Dim d As Integer
d = 0
Sheets ("Test1"). Select
Beach ("A1"). Select
Do during x> noOfComps
Selection.Offset (1, 0) .Select
Dim curComputer As String
curComputer = Selection.Value
Dim test1Row As Integer
d = d + 1
test1Row = ActiveCell.Row

Sheets ("TestS"). Select
Beach ("A1"). Select
Dim y As Integer
y = 0
Dim z as an integer
z = 0
Dim LastRowSummary As integer
LastRowSummary = Worksheets ("TestS"). Range ("A1"). CurrentRegion.Rows.Count - 1
Do While y <LastRowSummary
Selection.Offset (1, 0) .Select
If Selection.Value = curComputer then
z = 1
Dim SummaryRow As Integer
SummaryRow = ActiveCell.Row

Sheets ("Test1"). Select
Beach ("B" & test1Row) .Select
Dim curLogValue As Integer
curLogValue = Selection.Value

Sheets ("TestS"). Select
Range ("B" & SummaryRow) .Select
Selection.Value = curLogValue

Sheets ("Test1"). Select
Range ("A" & test1Row) .Select
Exit do
End if
y = y + 1
Loop

If z = 0 then
d = d + 1
Selection.Offset (1, 0) .Select

Selection.Value = curComputer
SummaryRow = ActiveCell.Row


Sheets ("Test1"). Select
Beach ("B" & test1Row) .Select
Dim curLogValue As Integer
curLogValue = Selection.Value

Sheets ("TestS"). Select
Range ("B" & SummaryRow) .Select
Selection.Value = curLogValue

Sheets ("Test1"). Select
Range ("A" & test1Row) .Select
End if
z = 0
d = d + 1
x = x + 1
Loop

Nickname Code:

1) CPU loop in Test1

2) Find the processor in TestS by looping each computer

3) If the processor matches both Test1 and TestS, paste the second column.

4) Otherwise, create a new line for the new computer and the 2nd column.

My question is how can I make this code more efficient?