爱问知识人 爱问教育 医院库

excel VB 模糊查找

首页

excel VB 模糊查找

各位,我想用EXCEL VB的函数功能编写个宏,用于查找某列中数据是否包含某一指定字段,请问可以用哪个函数,如何用?
别告诉我用EXCEL的模糊查询功能,我只想用函数,因为我要重复很多个特定字段,谢谢!

提交回答
好评回答
  • 2008-11-07 10:46:39
      问题还没解决呀,那上传一段代码供参考吧。
    Sub cxsj()
        Dim 查找值 As String, str1 As String, str2 As String
        Dim c As Range
        查找值 = Application。
      InputBox(prompt:="请输入要查找的值:", Title:="查找", Type:=2) If 查找值 = "False" Or 查找值 = "" Then Exit Sub Application。ScreenUpdating = False Application。
      DisplayAlerts = False With ActiveSheet。Cells Set c = 。Find(查找值, , , xlPart, xlByColumns, xlNext, False) If Not c Is Nothing Then str1 = c。
      Address Do c。Interior。ColorIndex = 4 '加亮显示 str2 = str2 & c。Address & vbCrLf Set c = 。
      FindNext(c) Loop While Not c Is Nothing And c。Address <> str1 End If End With MsgBox "查找到指定数据在以下单元格中:" & vbCrLf & vbCrLf & str2, vbInformation + vbOKOnly, "查找结果" Application。
      ScreenUpdating = True Application。DisplayAlerts = True End Sub 。

    思***

    2008-11-07 10:46:39

类似问题

换一换
  • 软件 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):