+ Reply to Thread
Results 1 to 4 of 4

Adding apostrophe to cells

  1. #1
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Adding apostrophe to cells

    We have a column of numbers that need to have an apostrophe placed in front of them in each cell. Ive tried to add them using a formula, but the software that we are uploading the xls file to doesnt like the formula in the cell and stops the upload. Adding the ' manually, however, works fine. Is there a way to create a macro that mimics the adding of the apostrophe?

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    07-14-2011
    Location
    Québec
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Adding apostrophe to cells

    Not sure to undertand what you want to do...

    If you want to add apostrophe to force data to be text, you could you have a VBA macro do:
    myrange = "G5:H8"
    For Each cell In ActiveSheet.Range(myrange)
    cell.Value = "'" & cell.Value 'NOTE: double quote - apostrophe - double quote
    Next c
    or in another cell, you could use
    =TEXT(yourcellwithnumericalvalue,"@")

  3. #3
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Adding apostrophe to cells

    I just have a column (A) with hundreds of rows. Each cell has a number. I just want to add an apostrophe to the front of each number.

  4. #4
    Registered User
    Join Date
    07-14-2011
    Location
    Québec
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Adding apostrophe to cells

    Quote Originally Posted by scottdog129 View Post
    I just have a column (A) with hundreds of rows. Each cell has a number. I just want to add an apostrophe to the front of each number.
    Then you could go with
    myrange = "A5:A1005"
    For Each cell In ActiveSheet.Range(myrange)
    if left(cell.Value,1)<>"'" Then cell.Value = "'" & cell.Value 'NOTE: double quote - apostrophe - double quote
    Next cell

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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