Numerals conversion

L

Luciano

Hi,
Does somebody have any idea about how to develop some VBA function or macroaiming conversion of several numerals types and that could be used for small and large numbers(e.g. 100000000000 in decimal)? The major numerals basefor which I need this conversions are:
Binary (Base 2)
Ternary (Base 3)
Quaternary (Base 4)
Quinary (Baase 5)
Senary (Base 6)
Septenary (Base 7)
Octal (Base 8)
Nonary (Base 9)
Decimal (Base 10)
Undecimal (Base 11)
Duodecimal (Base 12)
Base 13
Hexadecimal (Base 16)
Vigesimal (Base 20)

Thanks in advance,
Luciano
 
L

Living the Dream

Hi there Luciano

Not sure if I am reading right or not.

Have a look at the following, it may point you in the right direction.

It assumes your numbers you want to convert are in Column "B", so
anytime you enter the base value you have presented the adjacent cell
will change its decimal count to the number entered.

I may have misinterpreted what it is you're needing, but someone else
may have another idea for you to run with.

HTH
Mick.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim r As Long

If Not Intersect(Target, Range("A1:A20")) Is Nothing Then

Select Case True

Case Target.Value = 2
With ActiveCell
.Offset(0, 1).NumberFormat = "0.00"
End With
Case Target.Value = 3
With ActiveCell
.Offset(0, 1).NumberFormat = "0.000"
End With
Case Target.Value = 4
With ActiveCell
.Offset(0, 1).NumberFormat = "0.0000"
End With
Case Target.Value = 5
With ActiveCell
.Offset(0, 1).NumberFormat = "0.00000"
End With
Case Target.Value = 6
With ActiveCell
.Offset(0, 1).NumberFormat = "0.000000"
End With
Case Target.Value = 7
With ActiveCell
.Offset(0, 1).NumberFormat = "0.0000000"
End With
Case Target.Value = 8
With ActiveCell
.Offset(0, 1).NumberFormat = "0.00000000"
End With
Case Target.Value = 9
With ActiveCell
.Offset(0, 1).NumberFormat = "0.000000000"
End With
Case Target.Value = 10
With ActiveCell
.Offset(0, 1).NumberFormat = "0.0000000000"
End With
Case Target.Value = 11
With ActiveCell
.Offset(0, 1).NumberFormat = "0.00000000000"
End With
Case Target.Value = 12
With ActiveCell
.Offset(0, 1).NumberFormat = "0.000000000000"
End With
Case Target.Value = 16
With ActiveCell
.Offset(0, 1).NumberFormat = "0.0000000000000000"
End With
Case Target.Value = 20
With ActiveCell
.Offset(0, 1).NumberFormat = "0.00000000000000000000"
End With
Case Else
r = MsgBox("You Need to enter a number between 2 & 20")

End Select
End If
End Sub
 
L

Living the Dream

Hey there Luciano

I do not respond to direct mail, unless invited.

The reason for this apart from Newsgroup Etiquette is that others whom
may have a similar need miss out.

I see you have a few responses to your other thread so will discontinue
this on.

Cheers
Mick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Convert numerals 1

Top