Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dave
 
Posts: n/a
Default Function or Formula

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

  #2   Report Post  
Don Guillett
 
Posts: n/a
Default Function or Formula

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



  #3   Report Post  
Dave
 
Posts: n/a
Default Function or Formula

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




  #6   Report Post  
Don Guillett
 
Posts: n/a
Default Function or Formula

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









  #7   Report Post  
Gord Dibben
 
Posts: n/a
Default Function or Formula

Dave

You would need to capture a sheet event(the change of value in J21)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$J$21" And Target.Value < "" Then
ActiveSheet.Cells(Rows.Count, 12).End(xlUp) _
.Offset(1, 0).Value = Target.Value
End If
stoppit:
Application.EnableEvents = True
End Sub

This code assumes L20 is not blank to start with.

Right-click on the sheet tab and "View Code".

Paste the above code into that module.

Enter something in L20 to start with. You can delete it after L21 is
populated first time the event fires.


Gord Dibben Excel MVP

On Tue, 1 Nov 2005 10:00:03 -0800, "Dave"
wrote:

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


  #8   Report Post  
Dave
 
Posts: n/a
Default Function or Formula

Hi Gord
Thanks for your reply
I'm afraid thats not working,i'm sorry but not very experienced at
programming.
Do you think it could be that J21 is the result of a MAX Function
ie:MAX(J2:J20)
is somehow stopping it from working.
Dave

"Gord Dibben" wrote:

Dave

You would need to capture a sheet event(the change of value in J21)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$J$21" And Target.Value < "" Then
ActiveSheet.Cells(Rows.Count, 12).End(xlUp) _
.Offset(1, 0).Value = Target.Value
End If
stoppit:
Application.EnableEvents = True
End Sub

This code assumes L20 is not blank to start with.

Right-click on the sheet tab and "View Code".

Paste the above code into that module.

Enter something in L20 to start with. You can delete it after L21 is
populated first time the event fires.


Gord Dibben Excel MVP

On Tue, 1 Nov 2005 10:00:03 -0800, "Dave"
wrote:

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



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
formula within IF function Shirley Excel Discussion (Misc queries) 5 June 8th 07 07:50 PM
use a formula as a cell reference in a function tony h Excel Worksheet Functions 6 October 4th 05 12:59 PM
Is there a formula, function or macro that accounts for shading of a cell or row? Jamie Furlong Excel Discussion (Misc queries) 1 August 12th 05 09:55 AM
clock Wildman Excel Worksheet Functions 2 April 26th 05 10:31 AM
function of "+" in the formula "=+(B19/50)*B10 josh66six Excel Discussion (Misc queries) 4 February 23rd 05 09:54 PM


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

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"