搜索加粗格式的单元格 [英] Searching for Bold formatted Cells

查看:67
本文介绍了搜索加粗格式的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在粗体之间设置一定范围的单元格. 这是我到目前为止的内容:

I am trying to set a range of cells between bold cells. Here is what I have so far:

With Worksheets("FC01.RPT")
.Cells(.Rows.Count, 1).End(xlUp).Offset(2) = "Individual Rate Guest"

我不是使用独立费率来宾",而是如何编写它以便它寻找粗体格式?

Instead of using "Individual Rate Guest", how can I write it so that it will look for a bold format?

谢谢!

推荐答案

这是您如何在工作表的E列中查找前两个粗体单元格(偏移量以在它们之间创建范围)的方式,与内容无关.如果您想要某些内容的粗体文本,则可以用文本替换*.如前所述,如果要查找所有粗体单元格,则需要创建一个循环.

This is how you would find the first two bold cells (offset to create a range between) in Column E of your worksheet regardless of content. You can replace the * with text if you wanted bold text of a certain content. As mentioned, if you wanted to find all bold cells, you would need to create a loop.

Sub FindBoldCells()

    Dim boldcell As Range
    Dim boldcell2 As Range

    Application.FindFormat.Clear

    Application.FindFormat.Font.Bold = True

    With Worksheets("FC01.RPT")

        Set boldcell = .Range("E:E").Find("*", SearchFormat:=True).Offset(1, 0)

        Set boldcell2 = .Range("E:E").Find("*", After:=boldcell, SearchFormat:=True).Offset(-1, 0)

    End With

End Sub

这篇关于搜索加粗格式的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆