将整个范围转换为小写,而无需遍历单元格间接 [英] Convert entire range to lowercase without looping through cells Indirect

查看:52
本文介绍了将整个范围转换为小写,而无需遍历单元格间接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看VBA代码,该代码将整个单元格范围转换为小写形式.我发现了以下内容:

I'm looking at VBA code that takes an entire range of cells and converts them into lowercase. I found the following:

[A1:A20] = [index(lower(A1:A20),)]

这在固定范围内可以很好地工作(不完全了解语法,但是找到了以下帖子:)

This works fine for a fixed range (don't entirely understand syntax, but found the following post:)

上面的发布详细代码

我的问题是这样

我希望能够动态设置范围,因为我正在处理不断变化的范围大小.但是,以下操作不起作用,而且我似乎也无法在VBA中使用INDIRECT().

I would like to be able to set the range dynamically as I'm dealing with changing range sizes. However, the following doesn't work, and I can't seem to be able to use INDIRECT() either in VBA.

Range("A1:A" & n) = [index(lower(Range("A1:A" & n)),)]

有没有办法使这项工作有效?我真的想避免使用for循环,因为我怀疑这应该快得多.

Is there a way to make this work? I would really like to avoid using a for loop as I suspect this should be a lot faster..

推荐答案

尝试一下:

Range("A1:A" & n) = Application.Evaluate("index(lower(A1:A" & n & "),)")

这篇关于将整个范围转换为小写,而无需遍历单元格间接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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