首页 > 其他分享 >vba-find

vba-find

时间:2023-01-03 09:58:45浏览次数:57  
标签:vba Set Cells 单元格 Find Worksheets find

(6条消息) VBA中find函数_狗老大的博客-CSDN博客_vba find函数

 

 

Sub test1()
    '
    Dim r As Range
    Dim s As String
    s = "Hello"
    Dim a As Range
    
    
    
    '查找第一个内容含有vba的单元格
    'Set r = Worksheets(1).Cells.Find("vba")
    
    '查找第一个内容精确为vba的单元格
    'Set r = Worksheets(1).Cells.Find(what:="vba", lookat:=xlWhole)

    '查找第一个包含大写字母"VBA",且单元格为红色的的单元格
    'Application.FindFormat.Interior.Color = vbRed
    'Set r = Worksheets(1).Cells.Find(what:=s,lookat:=xlPart, MatchCase:=True, Searchformat:=True)
    
    '找到第一个内容为“GWb”的单元格,并且大小写精确匹配。
    
    Set r = Range("I13")
    
    Do
        Set r = Worksheets(1).Cells.Find(what:=s, after:=r, lookat:=xlPart, MatchCase:=False, Searchformat:=False, LookIn:=xlValues)
        r.Interior.Color = vbBlue
  
         
        ' Set r = Worksheets(1).Cells.Find(what:=s, after:=a, lookat:=xlPart, MatchCase:=True, Searchformat:=False, LookIn:=xlFormulas)
         MsgBox (r.Address())
         
         If r.Address = "$I$13" Then Exit Do
    Loop While Not r Is Nothing
    
    
    MsgBox (r.Address())
End Sub
 

 

标签:vba,Set,Cells,单元格,Find,Worksheets,find
From: https://www.cnblogs.com/Insist-Y/p/17021109.html

相关文章

  • Excel VBA
    ExcelVBA显示隐藏菜单编辑栏和页签Subvisible()'Application.DisplayFormulaBar=True'显示编辑栏ActiveWindow.DisplayHeadings=True'隐藏行列标题ActiveW......
  • Unable to find remote helper for 'https'
    出现这个报错,说明git目前的状态是正常的,要么没装好,要么自己解决压缩安装导致没有权限第三次情况是,使用yuminstallgit重新安装后,仍然报错,是因为环境变量中GIT_HOM配置的仍......
  • tp6 框架find 查询
    1,特别注意点find()查询时可以使用主键进行查询但是不能填写条件进行查询例如userModel::find(['username'=>$data['username']]);虽然这样写是可以查询出数据的......
  • find 和 grep命令
    findfind目录选项查找条件find.-name"liulei.txt"find.-name"*.txt"通配符grepgrep选项查找模式文件名......
  • java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you
    在使用RestTemplate时,写了一个测试测试方法,遇到了这个报错。java.lang.IllegalStateException:Unabletofinda@SpringBootConfiguration,youneedtouse@ContextCon......
  • VBA更新块属性
    修改块的属性后,如何应用到块参照?可以使用battman命令,还可以用attsync命令。使用attsync命令个格式是这样的,和命令行并不一样。ThisDrawing.SendCommand"AttsyncName"&......
  • AutoCAD VBA 获取字体样式列表
    cad中的可用字体样式  获取windows标准字体DimwinFontsdirAsStringwinFontsdir=VBA.Environ("windir")&"\Fonts\"IfwinFontsdir<>vbNullS......
  • Python处理Excel比Vba快100倍,媳妇连连夸赞今晚不用再跪搓衣板----python实战
    最近经历了一次把vb脚本改造成python脚本,并获得性能提升数倍的过程,当然,这个过程也不是一帆风顺,中间也经历了一些波折,但是,也收获了一波新的认知。正好最近有时间,姑且写下来记......
  • VBA 47 程序优化与提速的方法
    一、减少对象的调用二、减少计算次数三、禁止闪屏四、增加变量的声明类型五、减少工作表函数的使用六、减少VBA函数的使用七、用静态数组替换动态八、填充前先清空......
  • Macbook M2删除ACCFinderBundleLoader
    进入该文件:(这个目录每个人的电脑可能有点区别)folders下面不一定是37。(像我的电脑就是80)(可以使用ls查看文件下的所有文件)cd/private/var/folders/37/txl0523d74bgps8t0j......