Sub AAA()
Dim i As Integer
For i = 1 To 10000
If Cells(i, 1) = "TA11" Or Cells(i, 1) = "TA16" Or Cells(i, 1) = "TA18" Then
Cells(i, 3) = "YES"
ElseIf Cells(i, 1) = "TA12" Or Cells(i, 1) = "TA13" Or Cells(i, 1) = "TA19" Or Cells(i, 1) = "TA58" Then
Cells(i, 3) = "YES,sir"
ElseIf Cells(i, 1) = "CA11" Or Cells(i, 1) = "CA16" Or Cells(i, 1) = "CA18" Or Cells(i, 1) = "CA28" Then
Cells(i, 3) = "you right!!"
ElseIf Cells(i, 1) = "AA31" Or Cells(i, 1) = "AA56" Or Cells(i, 1) = "AA18" Or Cells(i, 1) = "AA68" Then
Cells(i, 3) = "HI"
Else
Cells(i, 3) = "NO"
End If
Next
End Sub
請教老師了~~感謝,感謝!!!作者: 准提部林 時間: 2015-10-9 18:47
Sub vlookup()
Dim data As Range
Set data = ['對照表'!$A$1:B$100]
For i = 2 To 1000
Cells(i, 2) = Application.vlookup(Cells(i, 1), data, 2, 0)
Next
End Sub作者: koo 時間: 2015-10-11 09:07
剛學過..現學現賣
vlookup沒找到會回傳錯誤所以要加個料
Dim j As Variant
k=Cells(i, 1)
j=Application.vlookup(k, data, 2, 0)
If Not IsError(j) Then
Cells(i,2)=j
End If作者: stillfish00 時間: 2015-10-12 10:49