PDA

View Full Version : downlist and formula



aoc
01-10-2010, 01:44 PM
Dear All,

In the attached file, in E14 ( same at G14, I14, K14 ), I will choose a currency from the list. If I choose €, the price format in E15, E16 ... will be €, If I choose $, it will be $. For example, I will choose €, the number 20 in E15 will be changed to 20 €. then d15 and e15 will be mutliplied to get the result in f15 with €. How can I do that ?


thanks,


osman

Bob Phillips
01-10-2010, 02:13 PM
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "E14, G14, I14, K14" '<== change to suit
Dim LastRow As Long
Dim i As Long

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

LastRow = Me.Cells(Me.Rows.Count, .Column).End(xlUp).Row
For i = 15 To LastRow

Me.Cells(i, .Column).NumberFormat = .Value & "#,##0.0"
Next i
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

aoc
01-11-2010, 02:49 PM
Hi xld,

thanks for the code, I tested it, when I choose $ it writes ytl and cells at row 15 column f h j l does not change and so row 27 column f h j l, can you please revise it.

regards

aoc
01-12-2010, 12:49 PM
hi xld,

thanks for the code, I tested it, when I choose $ it writes ytl and cells at row 15 column f h j l does not change and so row 27 column f h j l, can you please revise it.

regards

lucas
01-12-2010, 01:51 PM
Threads merged. Please don't start a new thread for a continuation of the same question. It becomes confusing for all concerned.

aoc
01-15-2010, 11:29 AM
Dear Lucas,

Can you please help me for my qestion on testing ?

regards,