+ Reply to Thread
Results 1 to 2 of 2

how to enter apostrophe at beginning and end of cell

  1. #1
    Registered User
    Join Date
    06-17-2011
    Location
    Cibolo, Texas
    MS-Off Ver
    Excel 2003
    Posts
    1

    how to enter apostrophe at beginning and end of cell

    Hey everyone,

    First time using this forum.

    I have an issue I cannot fix unless I manually edit or enter. I am trying to input an apostrophe at the beginning and end of a cell including a sequence of numbers that are separated by commas.

    What I want = Before: 4,23,101,102 After: '4,23,101,102'

    I have researched this for a while and have not found a viable fix yet.

    What I have tried:

    Formulas: ="'"&AN17&"'", =CONCATENATE("'",AN18,"'")

    Macros:

    Sub Apostrophe()
    For Each currentcell In Selection
    'Prevents inserting apostrophes in blank cells.
    If currentcell.Formula <> "" Then
    currentcell.Formula = "'" & currentcell.Formula & "'"
    End If
    Next
    End Sub

    The problem comes in that when I enter the number sequence manually to the cell, the result in the "formula bar" shows the number sequence minus the commas (ex. 4,23,101,102 in cell = 423101102 in formula bar). This is where the problem persists because every fix I have tried uses the "formula bar" data which does not include the commas.

    This is not an issue when I enter these in manually, but if I export a document with these number sequences, then I have to go to each one and add the apostrophe before and after.

    Any suggestions?!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: how to enter apostrophe at beginning and end of cell

    Based on your example, I don't understand why your Excel is taking an entry of
    4,23,101,102 and removing the commas. I would understand it if it was a typical number like 1,423,101,102. Is that the case? If it is, then you can get what you want using the TEXT function with concatenate.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1