I have tried to find my answer via past posts/answers but must be missing something or continually mis-typing.
I have a 53 worksheet workbook that has 10 sets of 5-worksheet accounts which include tabular data, and charts, including speedometer charts. It is working fine but I want users to be able to set currency symbols. The idea is that they will keep the basic workbook and copy/save it for each new project that sometimes will require non-U.S. currency.
I am currently getting "subscript out of range" error messages on the following macro:
Sub SetCurrency2()
Dim i As Integer
If Sheets("Spending Tracker").Range("N2") = "US" Then
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "[$$-409] * #,##0.00"
End With
Next i
ElseIf Sheets("Spending Tracker").Range("N2") = "UK" Then
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "£#,##0.00"
End With
Next i
ElseIf Sheets("Spending Tracker").Range("N2") = "EUR" Then
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "[$€-2] * #,##0.00"
End With
Next i
Else
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "¥#,##0.00"
End With
Next i
End If
End Sub
I have referenced the "Spending Tracker" worksheet where the dropdown exists (and which also has currency data) but also tried referring to it as "Sheet2" in case that was the problem. It apparently isn't.
I will appreciate some guidance on addressing this problem.
Thanks,
Charlie Carroll
I have a 53 worksheet workbook that has 10 sets of 5-worksheet accounts which include tabular data, and charts, including speedometer charts. It is working fine but I want users to be able to set currency symbols. The idea is that they will keep the basic workbook and copy/save it for each new project that sometimes will require non-U.S. currency.
I am currently getting "subscript out of range" error messages on the following macro:
Sub SetCurrency2()
Dim i As Integer
If Sheets("Spending Tracker").Range("N2") = "US" Then
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "[$$-409] * #,##0.00"
End With
Next i
ElseIf Sheets("Spending Tracker").Range("N2") = "UK" Then
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "£#,##0.00"
End With
Next i
ElseIf Sheets("Spending Tracker").Range("N2") = "EUR" Then
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "[$€-2] * #,##0.00"
End With
Next i
Else
For i = 1 To 53
With Sheets("Sheet" & i).Range("A1:Z1000")
.Style = "Currency"
.NumberFormat = "¥#,##0.00"
End With
Next i
End If
End Sub
I have referenced the "Spending Tracker" worksheet where the dropdown exists (and which also has currency data) but also tried referring to it as "Sheet2" in case that was the problem. It apparently isn't.
I will appreciate some guidance on addressing this problem.
Thanks,
Charlie Carroll