rodney_malodney
Board Regular
- Joined
- Jul 19, 2005
- Messages
- 116
hi, i've got a program that gives particular currency formats in required cells. they are found from a userform, with four options.
basically my problem lies in that i can't select a currency variable to declare as.
if only there was a "dim ~~~ as format"
i hope i haven't confused anyone...
Code:
Private Sub CommandButton1_Click()
'
Dim format As Currency
Dim text1 As String
Dim text2 As String
If OptionButton1 = True Then
text1 = "Total Sales Price £"
text2 = "List Price £"
format = "$#,##0.00"
Else
If OptionButton2 = True Then
text1 = "Total Sales Price €"
text2 = "List Price €"
format = "[$€-2] #,##0.00"
Else
If OptionButton3 = True Then
text1 = "Total Sales Price DKK"
text2 = "List Price DKK"
format = "[$DKK] #,##0.00"
Else
If OptionButton4 = True Then
text1 = "Total Sales Price $"
text2 = "List Price $"
format = "[$$-409]#,##0.00"
Application.EnableEvents = False
Sheets("Summary Sheet").Select
ActiveSheet.Unprotect
Range("c13:c44").Select
Selection.NumberFormat = format
Range("C47").Select
Selection.NumberFormat = format
Range("C49").Select
Selection.NumberFormat = format
ActiveSheet.Protect
'
Sheets("sales sheet (1)").Select
ActiveSheet.Unprotect
Range("H154").Select
Selection.NumberFormat = format
Range("H8").Select
ActiveCell = text1
Range("G8").Select
ActiveCell = text2
Range("G17:H153").Select
Selection.NumberFormat = format
ActiveSheet.Protect
'
UserForm2.Hide
'
Sheets("Cover Sheet").Select
'
Application.ScreenUpdating = True
'
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
basically my problem lies in that i can't select a currency variable to declare as.
if only there was a "dim ~~~ as format"
i hope i haven't confused anyone...