Hello there
I have tried to debug this code, but get this error type mismatch, I can't see where I falied.
My error comes in
I have tried to make this: SI Prefixes Unit Conversion Table - Tutorial, Definition, Example
Hope some can resolve it for me.
Thanks.
I have tried to debug this code, but get this error type mismatch, I can't see where I falied.
VBA Code:
Sub testt()
Dim i As Long
Dim myArray, asArray, X As String
X = "12k"
myArray = Array("Y", "Z", "E", "P", "T", "G", "k", "h", "da", "d", "c", "m", "µ", "n", "p", "f", "a", "z", "y")
asArray = Array(X * WorksheetFunction.Power(10, 24), _
X * WorksheetFunction.Power(10, 21), _
X * WorksheetFunction.Power(10, 18), _
X * WorksheetFunction.Power(10, 15), _
X * WorksheetFunction.Power(10, 12), _
X * WorksheetFunction.Power(10, 9), _
X * WorksheetFunction.Power(10, 6), _
X * WorksheetFunction.Power(10, 3), _
X * WorksheetFunction.Power(10, 2), _
X * WorksheetFunction.Power(10, 1), _
X * WorksheetFunction.Power(10, -1), _
X * WorksheetFunction.Power(10, -2), _
X * WorksheetFunction.Power(10, -3), _
X * WorksheetFunction.Power(10, -6), _
X * WorksheetFunction.Power(10, -9), _
X * WorksheetFunction.Power(10, -12), _
X * WorksheetFunction.Power(10, -15), _
X * WorksheetFunction.Power(10, -18), _
X * WorksheetFunction.Power(10, -21), _
X * WorksheetFunction.Power(10, -24))
For i = LBound(myArray) To UBound(myArray)
If Right(X, 1) Like myArray(i) Then
Debug.Print asArray(i)
End If
Next i
End Sub
My error comes in
VBA Code:
asArray = Array(X * WorksheetFunction.Power(10, 24), _
X * WorksheetFunction.Power(10, 21), _
X * WorksheetFunction.Power(10, 18), _
X * WorksheetFunction.Power(10, 15), _
X * WorksheetFunction.Power(10, 12), _
X * WorksheetFunction.Power(10, 9), _
X * WorksheetFunction.Power(10, 6), _
X * WorksheetFunction.Power(10, 3), _
X * WorksheetFunction.Power(10, 2), _
X * WorksheetFunction.Power(10, 1), _
X * WorksheetFunction.Power(10, -1), _
X * WorksheetFunction.Power(10, -2), _
X * WorksheetFunction.Power(10, -3), _
X * WorksheetFunction.Power(10, -6), _
X * WorksheetFunction.Power(10, -9), _
X * WorksheetFunction.Power(10, -12), _
X * WorksheetFunction.Power(10, -15), _
X * WorksheetFunction.Power(10, -18), _
X * WorksheetFunction.Power(10, -21), _
X * WorksheetFunction.Power(10, -24))
I have tried to make this: SI Prefixes Unit Conversion Table - Tutorial, Definition, Example
Hope some can resolve it for me.
Thanks.