嗨,我有下面的代码,我基本上创建之前,我的朋友在这里使用它。唯一的区别是我的代码使用动物,而他的代码使用水果。有没有人能告诉我如何分辨蛇和响尾蛇,苹果和菠萝,因为他用水果来分辨菠萝和苹果。这是我的代码。善意的建议,如果我的问题是一个烂摊子请问我,所以我可以使它更清楚。对不起,我的英语不好。
Sub lookup()
Dim TotalRows As Long
Dim rng As Range
Dim i As Long
'Copy lookup values from sheet1 to sheet3
Sheets("Sheet1").Select
TotalRows = ActiveSheet.UsedRange.Rows.Count
Range("A1:A" & TotalRows).Copy Destination:=Sheets("Sheet3").Range("A1")
'Go to the destination sheet
Sheets("Sheet3").Select
For i = 1 To TotalRows
'Search for the value on sheet2
Set rng = Sheets("Sheet2").UsedRange.Find(Cells(i, 1).Value)
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
Cells(i, 2).Value = rng.Value
End If
Next
End Sub
需要帮助。谢谢。
我找到了问题的答案
我只是搜索了苹果,然后把它变成了苹果,这样更独特。
下面是代码
Dim cl As Range
For Each cl In Range ("Q10:Q1000")
If cl Like "apple" Then
cl = "apples"
End if
Next cl