PDA

View Full Version : Text Format need help



jov_damo86
04-12-2010, 02:15 AM
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...:hi:

macropod
04-12-2010, 03:09 AM
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

jov_damo86
04-14-2010, 02:26 AM
Wow Great! Thank you! This Can help a lot...:thumb