I would like to ask somebody if he have any idea how to make this code go faster. Currently in case of large data (over 180 000 lines / 39 columns) it takes approx 5:50 hours to generate all code in case of using MS Excel 2007.
I would be happy for any advice.
Sub TOXML()
strChoosenFile = InputBox("Write number of file which you want generate.", "Choose sheet for generation XML")
Worksheets("time").Cells(1, 1) = Now
Application.ScreenUpdating = False
Dim lngRow As Long
Dim strInsetText$
lngRow = 1
RowsInSource = Worksheets(strChoosenFile).Range("A300000").End(xlUp).Row - 2
ColumnsInSource = Worksheets(strChoosenFile).Range("DD2").End(xlToLeft).Column
For i = 1 To RowsInSource
strInsetText = "<R>"
For x = 1 To ColumnsInSource
strInsetText = strInsetText & "<S>" & Worksheets(strChoosenFile).Cells(i + 2, x).Text & "</S>"
Next x
strInsetText = strInsetText & "</R>"
Worksheets(strChoosenFile & "-XML").Cells(lngRow, 1) = strInsetText
lngRow = lngRow + 1
strInsetText = ""
Next i
Worksheets("time").Cells(1, 2) = Now
Application.ScreenUpdating = True
MsgBox "Done: " & i - 1
End Sub