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: 160
Default Code Tweek Needed

Excel 2000, code located in the worksheet code object.

Testing the first of three parameter cases in this
worksheet code; columns P10:P13 (data entry cells),
V10:V13 (data entry cells), U19:U30 (data entry cells),
and column X19:X30 (code results cells):

Entering the value 100 in cell P10, and the value 50 in
cell V10 sets up a case for entries in U19:U30. After
entering the value 75 in cell U19, pressing enter, the
code should calculate the value 50 for cell X19. Instead,
there is no value entered in cell X19 (it is blank on
screen) and the cursor moves on to cell U20. No error
messages.

Entering the value 75 in AD19 results in #Div/0! in
cell AG19, result should be 50.
Entering the value 75 in AM19 results in #Div/0! in
cell AP19, result should be 50.
Entering the value 75 in AV19 results in #Div/0! in
cell AY19, result should be 50.

Can someone help me correct this?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As range)
Dim nRow As Long
Dim nRow1 As Long
Dim dV As Double
Dim dP As Double
Dim rng As range
Set rng = Intersect(range("U:U, AD:AD, AM:AM, AV:AV"), _
range("19:30, 51:62, 83:94"))
With Target
If .Count 1 Then Exit Sub
If NotIntersect(.Cells, rng) Is Nothing Then
nRow1 = Int((.row - 19) / 32)
nRow = Int(.Column - 21) / 9
dV = range("V10").Offset _
(nRow + 32 * nRow1, 0).Value
dP = range("P10").Offset _
(nRow + 32 * nRow1, 0).Value
Application.EnableEvents = False
.Offset(0, 3).Value = (.Value - dV) / (dP - dV)
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
VBA code Help needed liamothelegend Excel Programming 1 November 5th 03 12:25 PM
Code Tweek Needed Phil Hageman Excel Programming 0 October 7th 03 07:21 PM
code needed ibo Excel Programming 0 July 29th 03 05:32 PM


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

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"