Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Dave Lister
 
Posts: n/a
Default Can a macro be made to run on entering or leaving a cell?

I am trying to construct a spreadsheet in Excel 2003 where a sequence of
results are entered into a column as each event occurs. Each new result
(value) entered into the next cell of the column can be one of several
different types and the number & type of these results are recorded using
COUNT in another area of the sheet.
I want to enter the value returned by COUNT in the cell adjacent to last
result entered without it changing to the new value of COUNT when the next
result is entered into the column of results.
The formula in the adjacent cell (=value of cell returned by COUNT) can be
replaced by its value by a simple macro that copies itself then" paste
special_value" but can I make this macro run each time I leave the last
result cell in the result column?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Can a macro be made to run on entering or leaving a cell?

Dave

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
mycount = Range("F19").Value
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value < "" Then
Excel.Range("B" & n).Value = mycount
End If
End If
enditall:
Application.EnableEvents = True
End Sub

Will copy the current value of F19 into Bn


Gord Dibben Excel MVP

On Sat, 3 Dec 2005 09:43:02 -0800, "Dave Lister" <Dave
wrote:

I am trying to construct a spreadsheet in Excel 2003 where a sequence of
results are entered into a column as each event occurs. Each new result
(value) entered into the next cell of the column can be one of several
different types and the number & type of these results are recorded using
COUNT in another area of the sheet.
I want to enter the value returned by COUNT in the cell adjacent to last
result entered without it changing to the new value of COUNT when the next
result is entered into the column of results.
The formula in the adjacent cell (=value of cell returned by COUNT) can be
replaced by its value by a simple macro that copies itself then" paste
special_value" but can I make this macro run each time I leave the last
result cell in the result column?

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
Macro code for dropping to next empty cell JB2010 Excel Discussion (Misc queries) 4 November 3rd 05 01:35 PM
in cell editing macro ynissel Excel Discussion (Misc queries) 2 July 27th 05 07:28 PM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM
Perform oiperations relative to initial selected cell scratching my head Excel Discussion (Misc queries) 1 May 30th 05 05:42 PM
How can I edit cell contents with a macro in Excel? Mind the gaps! Excel Discussion (Misc queries) 2 March 23rd 05 08:51 PM


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