在特定字符后删除单元格中的数据 [英] delete data in cell after specific character

查看:103
本文介绍了在特定字符后删除单元格中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有单元格A1:A1000中的数据。这是一个名单,后跟一个小笔记,如下所示:

I have data in cells A1:A1000. It is a list of names followed by a small note, like this:


  • samfast

  • nicklong

  • tomquick

他们都有 和名称后面的空格,然后是音符。我想要做的是删除名称后的所有内容。

They all have " and a space after the names and then the note. What I am trying to do is delete the everything after the name.

我正在玩宏,尝试这样做,但无法获得任何工作。任何想法我该怎么做?

I was playing around with macros to try and do this, but could not get anything to work. Any idea how I might do this?

推荐答案

这是一个没有宏的漂亮的技巧:

Here is a nifty trick without macros:

适当的范围(或甚至只需点击 A 选择整个列),然后执行 Ctrl + F ,单击替换,在中查找准确写入* code>替换为框为空现在点击替换全部和tada!

Select the proper range (or even just click on A to select the entire column) and then do Ctrl+F, click Replace, in Find write exactly "* and leave the Replace with box empty. Now click Replace all and tada !

它将所有的内容替换为(并包含)引号,因为它使用 * 作为通配符,将替换框留空。

It replaces everything after (and including) the quote with nothing because it uses * as a wildcard you left the replace box empty.

编辑:正如这里所建议的,VBA代码为:

As suggested here is the VBA code for this:

Columns("A:A").Replace What:="""*", Replacement:="", LookAt:=xlPart

这篇关于在特定字符后删除单元格中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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