- #1
Saladsamurai
- 3,020
- 7
Excel VBA:: Run Time Error '13' Type MisMatch??
I keep getting this error when I run this code. Nothing is highlighted..and VBA help is not working out for me.
It just started when I added the for loop in bold below:
Any ideas? Am I missing the obvious (I usually do; not my specialty)?
Thanks
I keep getting this error when I run this code. Nothing is highlighted..and VBA help is not working out for me.
It just started when I added the for loop in bold below:
Code:
Option Explicit
Option Base 1Private Sub MathML_Converter()
Dim i As Integer
Dim j As Integer
Dim NumElements As Integer
Dim Text As String
Dim MyArray() As String
Dim MyNewArray() As String'***************************************************************
'Clear ActiveSheet
Sheets("Sheet1").Range("1:65536").ClearContents
Open "C:\Documents and Settings\Owner\Desktop\APC_Related\MathML.txt" _
For Input As #1 i = 1
Do While Not EOF(1)
Text = Input(1, #1)
ReDim Preserve MyArray(i)
MyArray(i) = Text
Cells(i, 1) = Text
i = i + 1
Loop
Close #1
NumElements = i - 1
' MsgBox "Number of Elements SHOULD be " & NumElements
' MsgBox "Number of Elements IS " & UBound(MyArray)
'*******************************************************************
[b]'Eliminate WhiteSpace From MyArray
j = 1
For i = 1 To NumElements
ReDim Preserve MyNewArray(j)
If MyArray(i) <> " " Then _
MyNewArray(j) = MyArray(i) & _
j = j + 1
Next i[/b]
Any ideas? Am I missing the obvious (I usually do; not my specialty)?
Thanks