Hi all.
I hope someone can help me out with the problem described here.
I've discovered that the complex math in Excel is badly implemented, since in english and danish, the different names means that the complex math stops working. For example we have:
English: IMSUB
Danish: IMAGSUB
and
English: IMPRODUCT
Danish: IMAGPRODUKT
If I create the spreadsheet in danish, it doesn't work in english version of Excel.
I thought I'd make a macro, which could search/replace these text strings. I'd place a
button and the user could choose language him-/herself. Just started looking into macros two days ago.
First I did a macro recording, which didn't continue to work. Simply because when I did the search/replace, the macro "forgets" to choose the entire workbook. It only searches the active sheet.
I continued by putting the words I want to search/replace into some cells. They are placed in Sheet "DK" in cell range B104-C104 as you can see below.
I coded the following:
Sub ToEnglish()
'
' ToEnglish Makro
' Makro indspillet 13-05-2010 af Claus Futtrup
'
'
SaveActSheet = ActiveSheet.Name
DK1 = Sheets("DK").Range("C103").Value
DK2 = Sheets("DK").Range("C104").Value
EN1 = Sheets("DK").Range("B103").Value
EN2 = Sheets("DK").Range("B104").Value
Sheets("5.47").Select
Cells.Replace What:=DK1, Replacement:=EN1, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=DK2, Replacement:=EN2, LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets(SaveActSheet).Select
End Sub
Sub ToDanish()
'
' ToDanish Makro
' Makro indspillet 13-05-2010 af Claus Futtrup
'
'
SaveActSheet = ActiveSheet.Name
DK1 = Sheets("DK").Range("C103").Value
DK2 = Sheets("DK").Range("C104").Value
EN1 = Sheets("DK").Range("B103").Value
EN2 = Sheets("DK").Range("B104").Value
Sheets("5.47").Select
Cells.Replace What:=EN1, Replacement:=DK1, LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=EN2, Replacement:=DK2, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets(SaveActSheet).Select
End Sub
Unfortunately the macro doesn't find anything to replace ... I am at a loss here. Running "BREAK" and "WATCH" the expressions DK1 and EN1 (stepping through the macro with F5) I can see that they stay empty ...
Please help me accomplish what I'd like to do.
Best regards,
Claus
Bookmarks