Adding Apostrophe in every field in particular column for excel

后端 未结 4 1059
终归单人心
终归单人心 2020-12-29 15:03

How can you add an apostrophe in every field in an Excel spreadsheet without individually typing it in? I have got like 5k fields

相关标签:
4条回答
  • 2020-12-29 15:34

    I'm going to suggest the non-obvious. There is a fantastic (and often under-used) tool called the Immediate Window in Visual Basic Editor. Basically, you can write out commands in VBA and execute them on the spot, sort of like command prompt. It's perfect for cases like this.

    Press ALT+F11 to open VBE, then Control+G to open the Immediate Window. Type the following and hit enter:

    for each v in range("K2:K5000") : v.value = "'" & v.value : next
    

    And boom! You are all done. No need to create a macro, declare variables, no need to drag and copy, etc. Close the window and get back to work. The only downfall is to undo it, you need to do it via code since VBA will destroy your undo stack (but that's simple).

    0 讨论(0)
  • 2020-12-29 15:37

    More universal can be: for each v Selection : v.value = "'" & v.value : next and selecting range of cells before execution

    0 讨论(0)
  • 2020-12-29 15:39

    The way I'd do this is:

    • In Cell L2, enter the formula ="'"&K2
    • Use the fill handle or Ctrl+D to fill it down to the length of Column K's values.
    • Select the whole of Column L's values and copy them to the clipboard
    • Select the same range in Column K, right-click to select 'Paste Special' and choose 'Values'
    0 讨论(0)
  • 2020-12-29 15:47

    i use concantenate. works for me.

    1. fill j2-j14 with '(appostrophe)
    2. enter L2 with formula =concantenate(j2,k2)
    3. copy L2 to L3-L14
    0 讨论(0)
提交回复
热议问题