码迷,mamicode.com
首页 > 编程语言 > 详细

VBA find方法

时间:2015-03-28 16:55:19      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

Sub Sample()

    Dim sfzs As New Collection
    Dim ws, wbs, dbs As Worksheet
    Dim r As Long
    
    Set ws = ThisWorkbook.Sheets("Sheet 1")
    Set wbs = ThisWorkbook.Sheets("五保")
    Set dbs = ThisWorkbook.Sheets("低保")

    Set dg = ws.Range("c2:c37573")
    Set dg = ws.Range("c:c")
    Set dg = ws.Columns("C")
    
    Application.ScreenUpdating = False
    
    With wbs
        For r = 1 To 356
            If dg.Find(.Range("D" & r).Value) Is Nothing Then
                .Range("f" & r).Value = "没在"
            Else
                .Range("f" & r).Value = ""
            End If
        Next r
    End With

    With dbs
        For r = 1 To 1560
            If dg.Find(.Range("D" & r).Value) Is Nothing Then
                .Range("f" & r).Value = "没在"
            Else
                .Range("f" & r).Value = ""
            End If
        Next r
    End With
    
    Application.ScreenUpdating = True
End Sub

 

VBA find方法

标签:

原文地址:http://www.cnblogs.com/xiangnan/p/4374332.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!