View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
minimaster minimaster is offline
external usenet poster
 
Posts: 73
Default Workbooks.Open oddity

After I discovered that "pastespecial" and "replace" method are not
able to make Excel recognize the numbers as numbers I've implemented
now a work around by converting each single cell separately with a
typeconversion. Not very fast but at least it works.

Sub myOpenXML()

Dim n As Range
Dim c As Range

Workbooks.Open Filename:="PAGE1.xml"

Set n = Range("A3:F" & LastCell(ActiveSheet).Row)

For Each c In n ' type conversion of every single cell : at
least this one works!
If TypeName(c.Value) = "String" Then
If InStr(1, c.Value, ",") Then
c.Value = CDbl(c.Value)
Else
c.Value = CInt(c.Value)
End If
End If
Next c

End Sub