Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Trigger macro when range entry complete

I have a range of cells; non-contiguous; namely

("D109, C111:K111, C114:K114")

What I would like to achieve is that when this range is complete with data
to have a macro run - lets call it "SetHR".

The range of cells is in a sheet called ("Current Round").

Now my thinking was to trigger the macro in the Worksheet_Change event - but
only trigger it when all cells in the range contain data (which is a mixture
of text and numeric), and the focus has now moved outwith the above range.
Furthermore not to run "SetHR" until any further change occurs to the above
range.

Hope this makes sense.

Any thoughts?

Sandy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Trigger macro when range entry complete

Sandy,

Right click your sheet tab, view code and paste this in. When all cells in
your range are populeted it call your macro and won't call it again until a
cell changes.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
Dim FilledCells As Long, TotCells As Long
Set MyRange = Range("D109, C111:K111, C114:K114")
If Intersect(Target, MyRange) Is Nothing Then Exit Sub

FilledCells = WorksheetFunction.CountA(MyRange)
TotCells = MyRange.Cells.Count
If FilledCells = TotCells Then
Call SetHR
End If
End Sub

Mike

"Sandy" wrote:

I have a range of cells; non-contiguous; namely

("D109, C111:K111, C114:K114")

What I would like to achieve is that when this range is complete with data
to have a macro run - lets call it "SetHR".

The range of cells is in a sheet called ("Current Round").

Now my thinking was to trigger the macro in the Worksheet_Change event - but
only trigger it when all cells in the range contain data (which is a mixture
of text and numeric), and the focus has now moved outwith the above range.
Furthermore not to run "SetHR" until any further change occurs to the above
range.

Hope this makes sense.

Any thoughts?

Sandy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Trigger macro when range entry complete

Mike
Thank you very much, works perfectly.
Sandy

"Mike H" wrote in message
...
Sandy,

Right click your sheet tab, view code and paste this in. When all cells in
your range are populeted it call your macro and won't call it again until
a
cell changes.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
Dim FilledCells As Long, TotCells As Long
Set MyRange = Range("D109, C111:K111, C114:K114")
If Intersect(Target, MyRange) Is Nothing Then Exit Sub

FilledCells = WorksheetFunction.CountA(MyRange)
TotCells = MyRange.Cells.Count
If FilledCells = TotCells Then
Call SetHR
End If
End Sub

Mike

"Sandy" wrote:

I have a range of cells; non-contiguous; namely

("D109, C111:K111, C114:K114")

What I would like to achieve is that when this range is complete with
data
to have a macro run - lets call it "SetHR".

The range of cells is in a sheet called ("Current Round").

Now my thinking was to trigger the macro in the Worksheet_Change event -
but
only trigger it when all cells in the range contain data (which is a
mixture
of text and numeric), and the focus has now moved outwith the above
range.
Furthermore not to run "SetHR" until any further change occurs to the
above
range.

Hope this makes sense.

Any thoughts?

Sandy

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
Insert formulas on data entry trigger Jim G Excel Programming 8 February 17th 09 01:02 PM
matched entry complete not working whylite Excel Programming 0 September 27th 06 06:45 AM
automatically add borders to a cell after entry is complete BKD Excel Discussion (Misc queries) 2 January 5th 06 01:09 AM
Trigger macro if an Activecell is within a specific Range helmekki[_44_] Excel Programming 0 October 24th 04 01:36 PM
Trigger macro if an Activecell is within a specific Range helmekki[_43_] Excel Programming 2 October 23rd 04 03:56 PM


All times are GMT +1. The time now is 01:10 PM.

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"