就是这个如何把sheet1.cells(i,2).value="是",如何把“是”这个值替换成被查找到的值
Sub查找d()Dim目标AsRange,rngAsRange,srngAsRange,iAsIntegerFori=1To1000Step1Setsrng=Sheet1...
Sub 查找d()
Dim 目标 As Range, rng As Range, srng As Range, i As Integer
For i = 1 To 1000 Step 1
Set srng = Sheet1.Cells(i, 1)
Sheet2.Select
With ActiveSheet.UsedRange
Set 目标 = .Find(srng, LookIn:=xlValues, lookat:=xlPart)
If Not 目标 Is Nothing Then
Sheet1.Cells(i, 2).Value = "是"
Else: Sheet1.Cells(i, 2).Value = "否"
End If
End With
Next i
End Sub 展开
Dim 目标 As Range, rng As Range, srng As Range, i As Integer
For i = 1 To 1000 Step 1
Set srng = Sheet1.Cells(i, 1)
Sheet2.Select
With ActiveSheet.UsedRange
Set 目标 = .Find(srng, LookIn:=xlValues, lookat:=xlPart)
If Not 目标 Is Nothing Then
Sheet1.Cells(i, 2).Value = "是"
Else: Sheet1.Cells(i, 2).Value = "否"
End If
End With
Next i
End Sub 展开
1个回答
展开全部
按键精灵 哈哈哈
Sub 查找d()
Dim 目标 As Range, rng As Range, srng As Range, i As Integer
For i = 1 To 1000 Step 1
Set srng = Sheet1.Cells(i, 1)
Sheet2.Select
With ActiveSheet.UsedRange
Set 目标 = .Find(srng, LookIn:=xlValues, lookat:=xlPart)
If Not 目标 Is Nothing Then
Sheet1.Cells(i, 2).Value = "是"
是 = Sheet1.Cells(i, 2).Value
Else: Sheet1.Cells(i, 2).Value = "否"
End If
End With
Next i
End Sub
Sub 查找d()
Dim 目标 As Range, rng As Range, srng As Range, i As Integer
For i = 1 To 1000 Step 1
Set srng = Sheet1.Cells(i, 1)
Sheet2.Select
With ActiveSheet.UsedRange
Set 目标 = .Find(srng, LookIn:=xlValues, lookat:=xlPart)
If Not 目标 Is Nothing Then
Sheet1.Cells(i, 2).Value = "是"
是 = Sheet1.Cells(i, 2).Value
Else: Sheet1.Cells(i, 2).Value = "否"
End If
End With
Next i
End Sub
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询