Hello everyone,
I have a mysterious problem: - I have made a macro (sub) called "ReloadRefresh". This macro calls other macro's I made, for example the macro "numberconversion". (view code below)
- When I walk through the entire macro and its embedded macro's line by line using the F8-step functionality for debugging, everything the code is designed for, is executed as it should.
- BUT when I just run the whole macro from the "macros" menu in Excel, the result is totally different. I don't understand why and how to fix it, I hope someone recognises this
These are the 2 macro's and their functionality:
The objective of my Excel project is to import stock data from the web. I have a few sheets with a data link to a website, so this data has to be refreshed. That's what the activeworkbook.refreshall is supposed to do: import all the data from today into the sheet. Then, because its an English website and I'm european, data and number formats need to be converted, so for every sheet I do this with the "numberconversion macro". But as described, it only works correctly when I walk through the code line by line, not if I call the ReloadRefresh Macro. Help!? :-)
Sub ReloadRefresh()
ActiveWorkbook.RefreshAll
Sheets("fund1").Select
Application.Run "'fonds research_pimped_dev_2013.xlsm'!nummerconversie"
Sheets("fund2").Select
Application.Run "'fonds research_pimped_dev_2013.xlsm'!nummerconversie"
Sheets("fund3").Select
End Sub
Sub Numberconversion()
'
' Numberconversion Macro, used to convert data imported from the web into usable numbers
'
'
Cells.Select
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("C:C").Select
Selection.TextToColumns Destination:=Range("C1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End Sub
Bookmarks