搜索
首页 电脑/网络 软件

excel VB 模糊查找

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

全部回答

2008-11-07

0 0

    问题还没解决呀,那上传一段代码供参考吧。 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 。

类似问题换一批

热点推荐

热度TOP

相关推荐
加载中...

热点搜索 换一换

电脑/网络
软件
程序设计
电脑装机
操作系统/系统故障
硬件
笔记本电脑
百度
互联网
反病毒
软件
软件
多媒体软件
系统软件
办公软件
网络软件
图像处理软件
举报
举报原因(必选):
取消确定举报