VBA formating excel change for example: 18D00132 to 1.8E+133

vlado23

New Member
Joined
Feb 22, 2018
Messages
2
Hello Friends,
I put to vba this:

Sub BehProgramu()
test = IsNumeric(786)
test = IsNumeric("Tech on the Net")
test = IsNumeric("234")
test = IsNumeric(18D00132)
End Sub

And when I click enter the last row is transfored to expon. format, why is excel doing this ?
Sub BehProgramu()
test = IsNumeric(786)
test = IsNumeric("Tech on the Net")
test = IsNumeric("234")
test = IsNumeric(1.8E+133)
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hello Friends,
I put to vba this:

Sub BehProgramu()
test = IsNumeric(786)
test = IsNumeric("Tech on the Net")
test = IsNumeric("234")
test = IsNumeric(18D00132)
End Sub

And when I click enter the last row is transfored to expon. format, why is excel doing this ?
Sub BehProgramu()
test = IsNumeric(786)
test = IsNumeric("Tech on the Net")
test = IsNumeric("234")
test = IsNumeric(1.8E+133)
End Sub


If you want 18D00132 to be a string, it has to be enclosed/encapsulated within quotation marks


test = IsNumeric("18D00132")


Without question marks, it is treated as a number automatically... The fact there is a letter D in there is irrelevant because clever VBA editor looks at what you've entered and says "Ah.. is this a HEXADECIMAL number?"

Hexadecimal numbers can and do contain letters up to F (see: https://simple.wikipedia.org/wiki/Hexadecimal_numeral_system)

test = IsNumeric(18D00132) is being converted into a Hexadecimal number!

Try changing the D to Z and see what happens!


test = IsNumeric(18Z00132)


Here, VBA throws an exception because it's looking at what you've entered.. assuming its a NUMBER (because no quotation marks) and then saying "but Hexadecimal only goes up to F... what is a Z in a number??? ERROR!!!


Hope that helps explain!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top