Gandalf
Member
Dear All, it has been quite some time since I last posted here so it is good to be back.
I have been preparing a workbook for my wife which looks at all staff and department costs and incomes to see which are profitable and which are not. As we are currently based in Mauritius for a UK based university all the currencies are in GBP but she would like to be able to look at the figures in both GBP and Mauritian Rupees.
What I have tried to do is create some VBA which will select all currency formatted cells and convert them to Rupees if they are in GBP or vice-versa.
The code I have is below
"Currency" is a named range from multiple worksheets.
Why do I always get this error message?
Thank you for any help.
I have been preparing a workbook for my wife which looks at all staff and department costs and incomes to see which are profitable and which are not. As we are currently based in Mauritius for a UK based university all the currencies are in GBP but she would like to be able to look at the figures in both GBP and Mauritian Rupees.
What I have tried to do is create some VBA which will select all currency formatted cells and convert them to Rupees if they are in GBP or vice-versa.
The code I have is below
Code:
Private Sub Currency_Click()
'Multiply by the exchange rate
getrate = InputBox("Enter the current rate")
If getrate = "" Then Exit Sub
userate = CDec(Format(getrate, "0.0000"))
For Each Cell In Range("Currency")
If Not Cell = "£" Then Cell.Value = Format(Cell * 50, "Rs" + "0.00")
If Cell = "Rs" Then Cell.Value = Format(Cell / 50, "£" + "0.00")
Next cell
End Sub
"Currency" is a named range from multiple worksheets.
Why do I always get this error message?

Thank you for any help.