Excel2007 中 视图->宏->查看宏
添加一个新宏名字,编辑然后,输入宏内容
功能介绍:把sheet1中的数据按行列匹配填入到sheet2中
Sub Testwork()
Dim answer As String
Dim cellName As String
For i = 2 To 281 Step 1
For j = 1 To 63 Step 1
If Worksheets("Sheet2").Range("A" & j) = Worksheets("Sheet1").Range("B" & i) And Worksheets("Sheet2").Range("B1") = Worksheets("Sheet1").Range("A" & i) Then
cellName = "C" & i
answer = Worksheets("Sheet1").Range(cellName)
Worksheets("Sheet2").Range("B" & j) = answer
End If
'MsgBox answer
Next j
Next i
End Sub