+ Reply to Thread
Results 1 to 3 of 3

VBA preceding single quote disappears after running macro

  1. #1
    Registered User
    Join Date
    07-25-2019
    Location
    Salt Lake City, UT
    MS-Off Ver
    2016 32 bit
    Posts
    21

    VBA preceding single quote disappears after running macro

    I found and modified a macro that trims and cleans all cells in a given dataset.

    The problem is that I have values in a column like this: '00001 that after running the clean & trim formula, look like this: 1.

    I tried first changing the cell value to {{{00001 and then change it back to '00001 after the clean & trim code has completed, but it doesn't fix the issue.

    Below is my code:

    Please Login or Register  to view this content.
    Last edited by joeyslaptop; 07-25-2019 at 06:38 PM. Reason: can't add my code.

  2. #2
    Registered User
    Join Date
    07-25-2019
    Location
    Salt Lake City, UT
    MS-Off Ver
    2016 32 bit
    Posts
    21

    Re: VBA preceding single quote disappears after running macro

    I found a way based on "prefixCharacter", but my macro is still really slow. At least it works. Does anyone have a better solution than the following?

    Please Login or Register  to view this content.
    UPDATE: Nevermind - it's not working. I had an unclosed IF statement that fooled me..
    Last edited by joeyslaptop; 07-25-2019 at 07:44 PM.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA preceding single quote disappears after running macro

    Hello joeyslaptop,

    If you simply need to display the number with the leading zeroes then you can format the cells to do so. The advantages are it is automatic and you do not have to convert a string back into a number.
    1. Select the cells or the entire column to be formatted.
    2. Right Click and select Format Cells... from the context menu.
    3. Under Category:, Click on Custom
    4. To the right of the Category: list, look for the Type: input box.
    5. Select the text in it and delete it
    6. Next, type in 00000
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Single quote vba
    By hanif in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2016, 04:58 AM
  2. SUM numbers from a single cell based on preceding text
    By richardj in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-26-2016, 11:24 AM
  3. [SOLVED] single quote/CID/single quote/comma
    By kl27302 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-09-2014, 10:10 AM
  4. [SOLVED] How to find and replace hidden single quote ? (This sign is single quote: ')
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2014, 03:48 PM
  5. [SOLVED] Button Disappears after running a Macro
    By Andrew.Trevayne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2012, 04:15 AM
  6. Logo disappears after running macro
    By AJO in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2009, 11:24 AM
  7. Single Quote
    By Kinjalip in forum Excel General
    Replies: 4
    Last Post: 04-06-2006, 07:30 AM

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