我需要获取“ SQL”表中的下一条记录。我已经编写了代码来从“ temp1”表中查找值,但是我想查找下一个值。
Sub Macro1()
Sheets("candidate data").Select
With ActiveSheet
.Cells(.Rows.Count, 1).End(xlUp).EntireRow.Select
.Cells(.Rows.Count, 1).End(xlUp).EntireRow.Copy
'Participant details gets updated
Sheets("Temp1").Activate
'Paste the row in a transpose format
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Rows("1:1").Select
Application.CutCopyMode = False
'Search for email
Dim myvar As Variant
'Store the name of the assessee in a variable
myvar = Worksheets("Temp1").Range("A8").Value
'Search for this assesee name in the list and select the row where the candidate name is there
'but i need find next value at this point from "SQL" sheet and paste the value in "temp2" sheet
Sheets("SQL").Select
Cells.Find(What:=myvar, after:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
'Select the entire row
ActiveCell.EntireRow.Copy
'Participant details gets updated
Sheets("Temp2").Activate
'Paste the row in a transpose format
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Rows("1:1").Select
Application.CutCopyMode = False
End With
End Sub