[英]How to copy part of a string from a specific cell to another cell with Excel macros?
How do I copy part of a string in a cell to another cell?如何将单元格中的部分字符串复制到另一个单元格?
For example: In cell A1 it says Force: 2035N
.例如:在单元格 A1 中显示Force: 2035N
。 I want to copy only the 2035N
part from it from A1 to B1.我只想将2035N
部分从 A1 复制到 B1。 How do I do that?我怎么做?
I started looking a MID substring.我开始寻找 MID substring。 So something like:所以像:
a=Mid(ActiveSheet.Range(“A1”), 1 5)).
But I'm completely new to VBA so I don't really know how to make it work.但我对 VBA 完全陌生,所以我真的不知道如何让它工作。
Edit: More info.编辑:更多信息。
I have a CSV file with lots of data in different rows.我有一个 CSV 文件,在不同的行中有很多数据。 I want to use a macro so I can sort all this data in a desired order and transpose it so I can just copy it to another excel file.我想使用一个宏,这样我就可以按所需的顺序对所有这些数据进行排序并转置它,这样我就可以将它复制到另一个 excel 文件中。
The characters from the whole string I want to copy from the original cell (let's say they are in cell A1-A7) are in bold (in the picture).我想从原始单元格中复制的整个字符串中的字符(假设它们在单元格 A1-A7 中)以粗体显示(在图片中)。 And this csv file is always in the same order and the characters are in the same place.而这个 csv 文件的顺序总是相同的,字符在同一个地方。
I want to copy the bold part of the cell from A1-A7 to for example B1-H1.我想将单元格的粗体部分从 A1-A7 复制到例如 B1-H1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.