Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Write a macro to find smt.

Hi,
I have a table like below:
A B
Currency Price
EUR 10,000
USD 5,000

I need to write a macro which shows the correct price after the client keys
in the currency they want the price to be quoted at.

Pls help me.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Write a macro to find smt.


Suppose your data is in Sheet2

In sheet1 A1 enter 'EUR
In sheet1 B1 enter the below formula

=IF(ISERROR(MATCH(A1,Sheet2!A1:A10)),"",INDEX(Shee t2!B1:B10,MATCH(A1,Sheet2!A1:A10,0)))

The same logic can be used in the macro. Right click sheet tab and view code
and paste the below . The currency value data is in Sheet2 ColA and B. Adjust
the range you would enter your currency.I take this as A1:A10 of Sheet1

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing Then
Dim ws1 As Worksheet
Set ws1 = ActiveWorkbook.Sheets("Sheet2")
If WorksheetFunction.CountIf(ws1.Range("A:A"), Target.Value) 0 Then
lngRow = WorksheetFunction.Match(Target.Value, ws1.Range("A:A"), 0)
Me.Range("B" & Target.Row) = _
WorksheetFunction.Index(ws1.Range("B:B"), lngRow)
End If
End If
Application.EnableEvents = True
End Sub



If this post helps click Yes
---------------
Jacob Skaria


"diepvic" wrote:

Hi,
I have a table like below:
A B
Currency Price
EUR 10,000
USD 5,000

I need to write a macro which shows the correct price after the client keys
in the currency they want the price to be quoted at.

Pls help me.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Write a macro to find smt.

Thx so much.
The excel function is quite simple & easy to use.
Thanks thanks thanks
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
Macro:- Find first blank cell and write text Mac0001UK Excel Worksheet Functions 4 May 17th 09 02:34 AM
write a macro to show the edit.find dialog box in excel evets Excel Programming 1 July 6th 08 07:31 PM
how do I write a macro to show the find dialog box in excel 2003 evets Excel Discussion (Misc queries) 1 July 6th 08 01:11 PM
Want to find a service company to write an Excel 2003 macro Balcott Excel Programming 15 October 30th 07 04:50 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM


All times are GMT +1. The time now is 11:13 PM.

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

About Us

"It's about Microsoft Excel"