+ Reply to Thread
Results 1 to 2 of 2

Convert number to text

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    Utah
    MS-Off Ver
    Excel 2003
    Posts
    3

    Convert number to text

    I am trying to create a Macro to convert a number to text. I have the following code:
    Sub Convert2Text()

    For Each Cell In Selection.Cells

    OldNF$ = Cell.NumberFormat

    Cell.NumberFormat = "@"

    Cell.Value = Application.Text(Cell.Value, OldNF$)

    Next

    End Sub
    This works great until I get to a cell with a blank value, then it returns a 0. I need it to leave the cell blank. I am very new at scripting but I was thinking some type of a condition loop applied to the above logic might work. Any help would be great. Thanks.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Convert number to text

    perhaps insert an IF statement

    Please Login or Register  to view this content.

+ 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