Consulting

Results 1 to 3 of 3

Thread: Text Format need help

  1. #1
    VBAX Regular
    Joined
    Oct 2009
    Location
    Philippines
    Posts
    14
    Location

    Text Format need help

    i need some help...

    How can i put scientific numbers to a textbox using vba?

    example:
    1.23456789E-3 ( range("A1") ) to 1.23E-3 (textbox(rounded to two digit))
    0.0000012345E-3 ( range("A1") ) to 1.23E-9 (textbox(rounded to two digit))


    Your help is much appreciated! Thank you...

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi jov_damo86,

    AFAIK, Excel textbox formulae can only reference a cell value as displayed. You could use a macro to populate the textbox, though. For example:
    Sub Demo()
    Dim StrRng As String
    With ActiveSheet
      StrRng = Selection.Address()
      ActiveSheet.Shapes.Range("Text Box 1").Select
      Selection.Characters.Text = Format(Range("A1").Value, "0.00E+00")
      .Range(StrRng).Select
    End With
    End Sub
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Regular
    Joined
    Oct 2009
    Location
    Philippines
    Posts
    14
    Location
    Wow Great! Thank you! This Can help a lot...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •