Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Dollars/Euros - handle multiple price fields

I have a tricky situation whereby I need to be able to allow two price
fields for the user to enter and the user will not always put in both
values:

Field 1
- US Dollars

Field 2
- Euro


Somehow need to show what the price will be in for either currency without
making too many calculation columns....

Is there a way to do this?

Thanks
Jason


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Dollars/Euros - handle multiple price fields

Hi Jason,

Maybe a worksheet change event would suit your requirements. Right click the
sheet tab, View code, and insert following (adapt ranges to suit):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range, cell As Range
Dim rDollars As Range, rEuros As Range
Dim xRate As Single

xRate = 1.35 ' better to get from some named cell

Set rDollars = Range("B2:B20") ' defined ranges maybe
Set rEuros = Range("C2:C20")

On Error GoTo errH
Application.EnableEvents = False

Set rng = Intersect(rDollars, Target)
If Not rng Is Nothing Then
For Each cell In rng
Cells(cell.Row, rEuros.Columns(1).Column) = cell / xRate
Next
Else
Set rng = Intersect(rEuros, Target)
If Not rng Is Nothing Then
For Each cell In rng
Cells(cell.Row, rDollars.Columns(1).Column) = cell * xRate
Next
End If
End If

Application.EnableEvents = True
Exit Sub
errH:
Resume Next
End Sub

If you define ranges for dollar & Euro prices, each in single columns with
same number of rows, modify the code like this:

Set rng = Intersect(Range("Dollars"), Target)
and similarly for Euros

Probably the code should include a more complete error handler in case user
inserts some text.

Regards,
Peter

wrote in message
...
I have a tricky situation whereby I need to be able to allow two price
fields for the user to enter and the user will not always put in both
values:

Field 1
- US Dollars

Field 2
- Euro


Somehow need to show what the price will be in for either currency without
making too many calculation columns....

Is there a way to do this?

Thanks
Jason




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i get euros instead of dollars from currency icon seamusrflynn Excel Discussion (Misc queries) 2 September 26th 09 05:43 PM
how best to handle longish text fields in excel? cass Excel Discussion (Misc queries) 3 March 28th 07 09:20 PM
Excel - Euros to U.S. Dollars Tricia Excel Worksheet Functions 2 March 11th 06 05:04 PM
How do i input euros and have it convert into dollars in the same. n1ghthawk Excel Discussion (Misc queries) 1 January 21st 05 04:16 PM
how do i change euros into australian dollars redback9454 Excel Worksheet Functions 1 December 15th 04 12:39 PM


All times are GMT +1. The time now is 08:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"