在Excel中为所有单元格添加公用前缀 [英] Add common prefix to all cells in Excel
本文介绍了在Excel中为所有单元格添加公用前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在每个单元格中都有一些文本列。
我想在所有单元格的开始添加一些文本,例如X。例如:
I have a column with some text in each cell.
I want to add some text, for example "X", at the start of all cells. For example:
A B
----- >>>> ----
1 X1
2 X2
3 X3
最简单的方法是什么?
推荐答案
在单元格B1中键入,然后复制...
Type this in cell B1, and copy down...
="X"&A1
这也可以工作:
=CONCATENATE("X",A1)
这里是VBA中的许多方法之一(免责声明:我不经常在VBA中编码)
And here's one of many ways to do this in VBA (Disclaimer: I don't code in VBA very often!):
Sub AddX()
Dim i As Long
With ActiveSheet
For i = 1 To .Range("A65536").End(xlUp).Row Step 1
.Cells(i, 2).Value = "X" & Trim(Str(.Cells(i, 1).Value))
Next i
End With
End Sub
这篇关于在Excel中为所有单元格添加公用前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文