View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Living the Dream Living the Dream is offline
external usenet poster
 
Posts: 151
Default Numerals conversion

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