Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
要寫一個Excel函數公式....
請問各位大大:
我要如何在Sheet4
A1 KEY入90分就可以把甲.乙.丙班的班級.名字.分數列出來?
資料庫如下
Sheet1
班級 名字 分數
甲 王小明 90
甲 陳小花 55
甲 李小玲 80
甲 楊 小珍 70
Sheet2
班級 名字 分數
乙 王大明 89
乙 陳大花 65
乙 李大玲 90
乙 楊 大珍 70
Sheet3
班級 名字 分數
丙 王中明 89
丙 陳中花 65
丙 李中玲 80
丙 楊 中珍 90
4 Answers
- Randy ChanLv 71 decade agoFavorite Answer
須要用指令,單靠公式好難做到。
Sub xxxxx()
Dim i As Integer, j As Integer
Dim x As Integer, lastX As Integer
Dim marks As Integer
x = 1
marks = Sheets("Sheet4").Cells(1, 1)
If marks = 0 Then
MsgBox "請在 Sheet4 輸入分數。"
End If
For i = 1 To 3
Sheets("Sheet" & i).Select
lastX = Cells(65536, 3).End(xlUp).Row
For j = 2 To lastX
If Cells(j, 3) = marks Then
x = x + 1
Cells(j, 1).EntireRow.Copy Sheets(4).Cells(x, 1).EntireRow
End If
Next
Next
If x = 1 Then
Sheets(4).Cells(1, 2) = "沒有找到"
End If
End Sub
2009-02-08 17:00:11 補充:
這句
Sheets(4).Cells(1, 2) = "沒有找到"
要改為
Sheets("Sheet4").Cells(1, 2) = "沒有找到"
2009-02-08 17:24:33 補充:
輸入分數要填在 Sheet4 的 A1
2009-02-08 21:28:05 補充:
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
另一個 "Sheets(4)" 也須小改,共改兩個。
Sheets(4) 改為 Sheets("Sheet4")
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
2009-02-12 23:36:56 補充:
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
是我寫的太混亂了,重新寫了一次,上面的不算了。
咖啡豆也要確保 Sheet1 Sheet2 Sheet3 Sheet4 存在沒錯呀。
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
2009-02-12 23:40:48 補充:
Sub searchstudent()
Dim WS As Worksheet
On Error Resume Next
For i = 1 To 4
Set WS = Nothing
Set WS = Sheets("Sheet" & i)
If WS Is Nothing Then
MsgBox ("沒找到 Sheet" & i)
Exit Sub
End If
Next
''''''待續
2009-02-12 23:41:20 補充:
''''''接上
Dim marks As Integer
marks = 0
entermarks:
marks = InputBox("請輸入須要搜尋的學生分數", vbYesNo, 90)
If marks = 0 Then GoTo entermarks
On Error GoTo 0
Sheets("Sheet4").Range("A1:D1000") = ""
Dim x As Integer
x = 1
''''''待續
2009-02-12 23:42:04 補充:
''''''接上
For i = 1 To 3
Sheets("Sheet" & i).Select
For j = 2 To Cells(65536, 3).End(xlUp).Row
If Cells(j, 3) = marks Then
x = x + 1
Cells(j, 1).EntireRow.Copy Sheets("Sheet4").Cells(x, 1).EntireRow
End If
Next
Next
''''''待續
2009-02-12 23:42:49 補充:
''''''接上
Sheets("Sheet4").Select
Cells(1, 1) = "得 " & marks & " 分的學生 :"
If x = 1 Then
Cells(2, 2) = "沒有找到"
End If
End Sub
- 1 decade ago
對. 總共有四個活頁.每頁都有學生的資料.
在活頁四.我想要知道90分的同學有那班那幾個?
謝謝
2009-02-11 13:23:46 補充:
出現了錯誤訊息 ,陣列索引超出範圍