+ Reply to Thread
Results 1 to 6 of 6

Macro inadvertently changing numbers formatted as text to scientific formatting

  1. #1
    Registered User
    Join Date
    11-20-2018
    Location
    Nashville, TN
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    3

    Macro inadvertently changing numbers formatted as text to scientific formatting

    Good afternoon. I'm using a macro that creates a hyperlink to our internal tracking system, using all the tracking numbers in column F. It turns all the tracking ID's into hyperlinks in their respective cells. (I did not come up with this code, I actually got the basis of it from a forum post on this site.) The tracking ID's are formatted as text, since excel doesn't like leading 0's, but they are necessary for tracking purposes. The macro works, except that the text displayed in the cell turns into scientific number formatting as soon as I run the macro. I've tried changing cl.Value to cl.Text after TextToDisplay, but it doesn't seem to work. Any ideas? (I am not including the actual url in the code since it's confidential/proprietary information. Thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Macro inadvertently changing numbers formatted as text to scientific formatting

    Did you try
    Please Login or Register  to view this content.
    Also, your destination range should be formatted as text or @.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    11-20-2018
    Location
    Nashville, TN
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    3

    Re: Macro inadvertently changing numbers formatted as text to scientific formatting

    Thank you so much for taking the time to reply. I made sure the destination range (incidentally, the same range as I'm referencing, since I wanted the hyperlinks in the same cells) are formatted as text. I tried Cstr(cl.Value) but unfortunately, the column still ended up changing to scientific format when I ran the macro. There's probably something obvious I'm missing, but I'm not sure what else to try.

    Again, I really appreciate the suggestion. I may end up just creating a new column and putting all the hyperlinks in that column with the text to display as "TRACK" or something similar.

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Macro inadvertently changing numbers formatted as text to scientific formatting

    the hyperlink could be wiping out the formatting and Excel default takes overs. I am not that 'Techie' but it seems logical. One other thing you could try is to put the number in like this:
    Please Login or Register  to view this content.
    and see if that works. If it does then maybe you can use a varibale like
    Please Login or Register  to view this content.
    I don't use hyperlinks enough to have much expertise with them, so I am guessing at what might work.
    Last edited by JLGWhiz; 11-30-2018 at 09:12 AM.

  5. #5
    Registered User
    Join Date
    11-20-2018
    Location
    Nashville, TN
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    3

    Re: Macro inadvertently changing numbers formatted as text to scientific formatting

    Logically, it seems like your suggestions should work, but even with those changes to the code, the format still changed to scientific. I really appreciate your suggestions, in any case. If for some reason I figure it out, I'll make sure to update this thread.

  6. #6
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Macro inadvertently changing numbers formatted as text to scientific formatting

    Thanks for the rep and good luck,
    Regards, JLG

+ 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] Replace functions calculates scientific numbers in text field
    By atdemeo in forum Excel General
    Replies: 3
    Last Post: 07-01-2018, 04:29 PM
  2. Replies: 8
    Last Post: 08-05-2015, 02:36 PM
  3. Replies: 2
    Last Post: 10-16-2014, 05:45 AM
  4. Replies: 5
    Last Post: 08-14-2012, 01:31 PM
  5. Replies: 3
    Last Post: 05-18-2009, 01:29 PM
  6. Stop Text Number formatting as Scientific
    By duanecwilson in forum Excel General
    Replies: 2
    Last Post: 09-25-2007, 05:03 PM
  7. [SOLVED] Changing References Inadvertently
    By Jim Reed in forum Excel General
    Replies: 0
    Last Post: 08-09-2006, 09:34 AM

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