Hi, I have to convert a Roman numerals to decimal numbers using two arrays, L() and D()... I need to take apart the numeral and then store it in an L() array cell, convert it, then store it in a D() array cell. Of course, I need to account for the fact that you need to subtract the numerals that are worth less than the one to the right of it. I assume you would just use If, Then statements for that. But I'm not sure what my professor means by, "take the numeral apart", or how to do it... Anyway, here's what I have so far, any help is much appreciated.
Sub RomToArab()
Dim L(1 To 100) As String, D(1 To 100) As Single, rome As String, romelength As Single, Sum As Single
Dim M, D, C, L, X, V, I As String
rome = UCase(InputBox("Enter your Roman Numeral: "))
romelength = Len(rome)
For I = 1 To romelength
Sum = 0
Select Case L(I)
Case "I"
Sum = Sum + 1
Case "V"
Sum = Sum + 5
Case "X"
Sum = Sum + 10
Case "L"
Sum = Sum + 50
Case "C"
Sum = Sum + 100
Case "D"
Sum = Sum + 500
Case "M"
Sum = Sum + 1000
End Select
Next I
End Sub
Bookmarks