+ Reply to Thread
Results 1 to 2 of 2

Why doesn't this work??

  1. #1
    Registered User
    Join Date
    10-09-2006
    Posts
    13

    Why doesn't this work??

    Basically, what I'm trying to do is convert the contents of a cell, both values AND formats, into a string. For example, the value of .08, formatted as a percent looks like 8.0%. I want the contents of this cell to be made into a string so it reads "8.0%" I tried doing this in VBA, it spits out the correct value, but it isn't in string format. Any help guys?

    format = Sheets("Array Data").Range("D12").NumberFormat
    Sheets("Converge").Range("A5").Select
    ActiveCell.Value = Application.WorksheetFunction.text(Sheets("Array Data").Range("D12"), format)

  2. #2
    Registered User
    Join Date
    10-09-2006
    Posts
    13
    Nevermind, figured it out. The cell has to be formatted as text first, before the value is put in. I added this (Selection.NumberFormat = "@") to the VBA code and now it works fine.

+ 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