LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need some help with enclosed script

I have generated the script below that will take three differenct currency
exchange rates located in Cells D1:F1 and based on a target cell input will
then convert the remaining adjoining cells into the adjusted currencys. The
script works well and the target cell when inputted the text turns red while
the adjoining cells text is black.

My problem is that if I change any of the currency rates in Cells D1:F1,
none of the target cells update. I auapect I need to enter some script that
will allow updating but I am at a loss as to what the script should be.
Obviously, it is not a recalc as there are no formula in the range cells.

Can someone please assist here? Thank you for any help offered.

Frick

Example:

D1:F1 1.00 0.81 1.71

Target Cells D9:F1500 1.23 1.00 2.11 (where the input
cell was E9 @1.00)


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sENTRYRANGE As String = "D9:F1500,G9:I1500,J9:L1500"
Const sRATERANGE As String = "D1:F1"
Dim rateArr As Variant
Dim entryArr As Variant
Dim rArea As Range
Dim temp As Double
Dim nCol As Integer
Dim startCol As Integer
Dim i As Integer

With Target
If .Count 1 Then Exit Sub
If Not Intersect(.Cells, Range(sENTRYRANGE)) _
Is Nothing Then
For Each rArea In Range(sENTRYRANGE).Areas
If Not Intersect(.Cells, rArea) Is Nothing Then
startCol = rArea(1).Column
End If
Next rArea
rateArr = Range(sRATERANGE).Value
ReDim entryArr(1 To 1, 1 To UBound(rateArr, 2))
nCol = .Column - startCol + 1
entryArr(1, nCol) = .Value
temp = entryArr(1, nCol) / rateArr(1, nCol)
For i = 1 To UBound(entryArr, 2)
If i < nCol Then _
entryArr(1, i) = temp * rateArr(1, i)
Next i
Application.EnableEvents = False
With Cells(.Row, startCol).Resize(1, UBound(entryArr, 2))
.Value = entryArr
.Font.ColorIndex = xlColorIndexAutomatic
.Font.Bold = False
End With
With Target
.Font.ColorIndex = 3
.Font.Bold = True
End With
Application.EnableEvents = True
End If
End With
End Sub


 
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
comment enclosed using vlookup Pran Excel Worksheet Functions 2 September 17th 09 09:41 AM
help with vba script lariveesl New Users to Excel 5 June 6th 09 08:53 AM
Please help with enclosed schedule of duty Huawei Excel Worksheet Functions 10 January 13th 06 02:46 PM
How do I export a csv file from Excel with fields enclosed in dou. mk_webman Excel Discussion (Misc queries) 2 December 24th 04 02:39 PM
what is a vb script george Excel Programming 1 July 16th 03 09:56 AM


All times are GMT +1. The time now is 02:48 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"