View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Code Udated - No Change

Phil,
I would assume you are supposed to change the number in column X19 for
example and see that the code is correctly updating the appropriate cells?
Then look in the worksheet code module and use the code there in your
workbook.

To correct your range problem. First make sure you don't have

Dim range as Range
or have range as an argument to a function.

then go to a general module and put in

Public Range as String

Then select the declaration and delete it.

This should clear up your capitalization problem although I don't think it
is contributing to whatever problem you seem to think you are having.

JE was referring to you changing the subject line in your post.


--
Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
Mr. McGimpsey, I confess to ignorance with the vinacular
here. How did I change the subject? I'll try not to do it
again. I don't understand the statement "It makes
it...Google...thread.

I came up on the ftp:... and it shows an .xls sheet with
the numbers, nothing more (answers are correct). Presume
this is all I'm supppose to see. I updated to your code
below with no response. Could the fact that my computer
will not capitalize the word "range" in the code mean VBA
will not recongize portions of the code? I sincerely
believe your efforts should be producing results, and that
the problem is simply me. Please bear with me - I'll try
whatever it takes. Could I sent the worksheet?

Thanks, Phil

-----Original Message-----
Phil - Please don't change subjects. It makes it

impossible for
Google to archive a thread.

Here's a workaround. I've updated the demo file as well:

ftp://ftp.mcgimpsey.com/excel/ph_demo.xls

Private Sub Worksheet_Change(ByVal Target As Range)
Dim nRow As Long
Dim dV As Double
Dim dP As Double
Dim nStart As Long
With Target
If .Count 1 Then Exit Sub
If Not Intersect(.Cells, Range( _
"U19:U30,AD19:AD30,AM19:AM30,AV19:AV30

," & _
"U51:U62,AD51:AD62,AM51:AM62,AV51:AV62

," & _
"U83:U94,AD83:AD94,AM83:AM94,AV83:AV94

")) _
Is Nothing Then
nStart = 10 - 32 * ((.Row = 51) + (.Row
= 83))
nRow = (.Column - 21) / 9
dV = Range("V" & nStart).Offset(nRow,

0).Value
dP = Range("P" & nStart).Offset(nRow,

0).Value
If Not dP = dV Then
Application.EnableEvents = False
.Offset(0, 3).Value = (.Value - dV) /

(dP - dV)
Application.EnableEvents = True
End If
End If
End With
End Sub

In article ,
"Phil Hageman"

wrote:

Tom, Maybe you've hit on something here - it is obvious

to
me, but wouldn't be to you, and I have been passing

over
it every time I communicate with you folks. Makes me
wonder what else I'm not telling you...

It is possible some "P", "V", and "U" cells may hold no
values - this is a legitimate circumstance for the

user.
Sounds like this may be my problem - the cause of blank
and #Div/0!answers. Can you: 1.) modify the code to

work
around blank cells (dp - dv < 0), and 2.) make it work

in
all three regions of the worksheet independent of cell
entries.

Is it possible for me to send you the worksheet via e-

mail?
.