Tuesday, April 11, 2017

NPrinting Exporting Numbers as Text...grrrrr

At first, I was   (╯°□°)╯︵ ┻━┻   and   ლ(`ー´ლ)  and   ಥ_ಥ  and just about became a
 ““”̿ ̿ ̿ ̿ ̿’̿’̵͇̿̿з=(•̪●)=ε/̵͇̿̿/̿ ̿ ̿ ̿ ̿’““  ! No matter what I did, NPrinting would export my darn tables as text! If it could only translate the values to numbers like I can translate text emoticons into feelings.

calculating...calculating...calculating...calculating...calculating...calculating...

At first, I was flipping tables and angry face and sad and just about became a crazed gunner! Then, I found and adapted an Excel macro that gave me a ヽ(´▽`)/  .


Sub FixFormula()
If Range("ZZ1") <> 1 Then
    ActiveSheet.Range("B8:B500").Select
    With Selection
        Selection.NumberFormat = "General"
        .Value = .Value
    End With
    Range("$ZZ$1").Value = 1
    Application.Goto Sheet1.Range("A1"), True
End If
Range("ZZ1") = 1
End Sub

Based on how you build your tables (and how you use the NUM function in your expressions), NPrinting's Excel reports don't know how to display the numbers. It simply defaults to text. And that sucks because you get the annoying 'green triangle of confusion' in the top left corner:


Not only does it look stupid, but your users can't do anything with a bunch of text that looks like numbers. Sure, they could re-format the cells as numbers, but Excel doesn't care. They'd not only have to re-format, but then they have to F2 (or click in the formula bar) to get it to really re-format. As in most things that go wrong in life, I blame Bill Gates.


He's obviously a witch, always casting spells.

A couple of things to note in the macro:

  1. Checking/Changing ZZ1  to "1" makes it so the macro only runs the first time the document is opened.
  2. GoTo A1 is just good manners. It's annoying to have a cell right in the middle of your report highlighted.
  3. The users' Excel security settings will mess with your results.
  4. Don't forget to send it as an XLSM instead of XLSX format.
  5. Save the macro in your NPrinting template.

Put it into practice, and you'll feel like (。◕‿◕。) !

 calculating...calculating...calculating...calculating...calculating...calculating...


(Cute face with big eyes)

1 comment:

  1. BUY WORLD MOBILE DATABASES FOR SMS ADVERTISING

    We have sourced over millions of Mobile phone numbers of almost every country in the world and we have put them into a database for businesses to purchase for there advertising needs. While email and social media are important, many people prefer the ease and simplicity of text communication. Be sure to use more than one contact channel when developing your marketing and sales campaigns and include SMS Text Marketing lists.
    It´s very easy to use, you just need to go to http://www.worldmobiledatabases.com and choose which is the Country Cell phone number database you want to advertise your services. After the purchase you can start using your Cell phone database right away.


    See more at http://www.worldmobiledatabases.com

    ReplyDelete