【问题标题】:Get Excel Range of cells when cell content length is above 300 characters当单元格内容长度超过 300 个字符时获取 Excel 单元格范围
【发布时间】:2014-06-30 12:19:43
【问题描述】:

我在 Excel 表中有 10 行和 10 列。 在此范围内,某些单元格的字符数超过 300 个。 我可以获取内容超过 300 个字符的特定单元格范围吗?

like Range("A3,B5,A10").Select

有没有一种方法可以在不使用 Javascript 或 Excel VBA 中的循环的情况下获取上述单元格范围?

【问题讨论】:

  • 不是没有循环,没有。

标签: javascript excel vba


【解决方案1】:

考虑:

Sub GetTheBigOnes()
    Dim rFull As Range, rBig As Range
    Set rFull = Range("A1:J10")
    Set rBig = Nothing
    For Each r In rFull
        If Len(r.Value) > 300 Then
            If rBig Is Nothing Then
                Set rBig = r
            Else
                Set rBig = Union(rBig, r)
            End If
        End If
    Next r
    MsgBox rBig.Address(0, 0)
End Sub

【讨论】:

  • 有没有不使用循环的解决方案?
  • 有没有办法使用条件格式来获取范围?
猜你喜欢
  • 2021-06-07
  • 2021-01-10
  • 2014-07-10
  • 1970-01-01
  • 2016-02-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-26
相关资源
最近更新 更多