View Single Post
  #10   Report Post  
Dave
 
Posts: n/a
Default Function or Formula

Don
Just had a another go at running the Code and this time it came up with a
Run-time error '13': Type Mismatch and the Debugger highlighted the line
If Target < Range("$J$2:$J$20") Then
Any help to you, sorry i'm novice when it comes to programming.


"Don Guillett" wrote:

I guess there is a misunderstanding. If the target does not change by
entering something in it this macro will not fire. What cell(s) change, BY
ENTERING DATA, that then changes j21. If you are entering data in j2:j20
then the restriction would change.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target < Range("$j$1:$j$20") Then Exit Sub
Range("L21").Insert (xlShiftDown)
Range("L21") = Target * 2
End Sub

--
Don Guillett
SalesAid Software

"Dave" wrote in message
...
Hi Don
Thanks once again.
Sorry but done exactly as you instructed, right clicked sheet tab and

inserted
function and saved.
Would it make any difference to the function if J21 was the result of MAX
Function
(J2:J20)
Dave

"Don Guillett" wrote:

Perhaps you placed in a REGULAR module instead of the sheet module as
instructed.
right click sheet tabview codeinsert thissave

--
Don Guillett
SalesAid Software

"Dave" wrote in message
...
Hi Don
Thanks for your reply
I've done exactly as you suggested but its not working.
Other Modules in my Workbook are working correctly, I'm
using Excel 2003.
Any ideas?


"Don Guillett" wrote:

right click sheet tabview codeinsert thissave

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$J$21" Then
Range("L21").Insert (xlShiftDown)
Range("L21") = Target * 2
End If
End Sub

--
Don Guillett
SalesAid Software

"Dave" wrote in message
...
Is there a Function or Formula that can store data from say cell

$J$21
and
store the
result in L21 in the same worksheet and every time the data in

$J$21
changes
the result moves down 1 ie: L22 etc.
This would happen at the most 20 times a day.
Any help would be appreciated