Excelmacros将整列更改为大写

我正在尝试更新工作簿,我必须将所有电子邮件从小写更改为大写。 我对macros还不是很了解,但是我想出了这个,但是它需要永远运行。 (只有约1千行)。

Sub Uppercase() ' Loop to cycle through each cell in the specified range. For Each x In Range("B:B") ' Change the text in the column to uppercase letters. x.Value = UCase(x.Value) Next End Sub 

有什么更好的,我应该使用?

我需要改变整个大小写的情况下,大写。

根本不需要循环,这应该基本上立即照顾它:

 Sub tgr() With Range("B1", Cells(Rows.Count, "B").End(xlUp)) .Value = Evaluate("INDEX(UPPER(" & .Address(External:=True) & "),)") End With End Sub 

一次做整个范围:

 Range("B:B") = [index(Upper(B:B),)] 

试试这个。 循环遍历B列中的每个单元格,这就是为什么它慢。

 Sub Uppercase() ' Loop to cycle through each cell in the specified range. For Each x In Range("B1:B" & Range("B" & Rows.Count).End(xlUp).Row)) ' Change the text in the column to uppercase letters. x.Value = UCase(x.Value) Next End Sub