I have an Excel file where I'm trying to convert prices in different currencies. I've made a macro which determines the currency and convert it into a cell in the R column. I would like to loop this through the R column until there is nothing in the currency cell.
I made a macro, but when I'm trying to loop it freezes Excel. I would be really grateful for your help, the code is the following:
Sub valutakereses()
Dim c As Range
Dim price As Range
With ActiveSheet.Range("A1:Z1")
Set c = .Find("Cost currency", LookAt:=xlWhole)
Set price = .Find("INTL Price", LookAt:=xlWhole)
End With
ActiveSheet.Range("R2").Select
Do
Set c = c.Offset(1, 0)
Set price = price.Offset(1, 0)
If c = "US$" Then
ActiveCell.FormulaR1C1 = price * "300"
ElseIf c = "DKK" Then
ActiveCell.FormulaR1C1 = price * "50"
ElseIf c = "EUR" Then
ActiveCell.FormulaR1C1 = price * "365"
ElseIf c = "GBP" Then
ActiveCell.FormulaR1C1 = price * "405"
ElseIf c = "NKR" Then
ActiveCell.FormulaR1C1 = price * "35"
ElseIf c = "SEK" Then
ActiveCell.FormulaR1C1 = price * "36"
ElseIf c = "SGD" Then
ActiveCell.FormulaR1C1 = price * "225"
ElseIf c = "SKR" Then
ActiveCell.FormulaR1C1 = price * "36"
End If
ActiveCell.Offset(1, 0).Select
Loop While Not c Is Nothing
End Sub