View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey[_141_] ExcelMonkey[_141_] is offline
external usenet poster
 
Posts: 1
Default Passing format to variable Part 2

I am passing a currenct number format to a variable and using applying
this format to a range. The number formats themselves are driven by a
Case Statement. If the currency chosen equals one of five specific
currencies I pass one of 5 specific formats to a variable. I want to
put a 6th condition in the Case Statement that says, If the currency
equal something other than the five prescribed Cases, then pass the
text string into the format itself. I am using a Case Else statement
for this 6th condition. I just do not know how to incorpoate the
variable "Currencies" into the format string. Does anyone know how to
do this?

See below:

Select Case Currencies
Case Is = "USD"
CurrencyFormat = "$""US"" #,##0_);[Red]($#,##0)"

Case Is = "CDN"
CurrencyFormat = "$""CDN"" #,##0_);[Red]($#,##0)"

Case Is = "GBP"
CurrencyFormat = "£ #,##0_);[Red]($#,##0)"

Case Is = "Euros"
CurrencyFormat = "€ #,##0_);[Red]($#,##0)"

Case Is = "Yen"
CurrencyFormat = "¥ #,##0_);[Red]($#,##0)"

Case Else
CurrencyFormat = Currencies & " #,##0_);[Red]($#,##0)"

End Select


---
Message posted from http://www.ExcelForum.com/