直接編寫代碼可以解決!
Sub?ss()Dim?MyRows1?As?Long
Dim?MyRows2?As?Long
Dim?MyRows3?As?Long
Dim?MyRows4?As?Long
Dim?Name1?As?String
Dim?Name2?As?String
Dim?Name3?As?String
Dim?MyData?As?Single
With?Excel.Application.ActiveWorkbook
MyRows4?=?1
MyRows3?=?3
Do?While?.Sheets("Sheet3").Cells(MyRows3,?1)?<>?""
Name1?=?.Sheets("Sheet3").Cells(MyRows3,?1)
Name2?=?.Sheets("Sheet3").Cells(MyRows3,?2)
MyRows2?=?3
Name3?=?""
Do?While?.Sheets("Sheet2").Cells(MyRows2,?1)?<>?""
If?.Sheets("Sheet2").Cells(MyRows2,?1)?=?Name1?And?.Sheets("Sheet2").Cells(MyRows2,?2)?=?Name2?Then Name3?=?.Sheets("Sheet2").Cells(MyRows2,?3) Exit?Do End?If MyRows2?=?MyRows2?+?1Loop
If?Name3?<>?""?Then
MyData?=?-999.999 MyRows1?=?3 Do?While?.Sheets("Sheet1").Cells(MyRows1,?1)?<>?"" If?.Sheets("Sheet1").Cells(MyRows1,?1)?=?Name1?And?.Sheets("Sheet1").Cells(MyRows1,?2)?=?Name3?ThenMyData?=?.Sheets("Sheet1").Cells(MyRows2,?3)
Exit?Do
End?If MyRows1?=?MyRows1?+?1 LoopEnd?If
If?MyData?<>?-999.999?Then
MyRows4?=?MyRows4?+?1 .Sheets("Sheet4").Cells(MyRows4,?1)?=?Name1 .Sheets("Sheet4").Cells(MyRows4,?2)?=?Name2 .Sheets("Sheet4").Cells(MyRows4,?3)?=?Name3 .Sheets("Sheet4").Cells(MyRows4,?4)?=?MyDataEnd?If
MyRows3?=?MyRows3?+?1
Loop
End?With
End?Sub