Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Executing a macro

Can a macro automatically be executed by the changing of a cell value?

I have someone who is a master sheet of data. He wants to split this sheet
based on won/lost value in a cell. The data will be moved to a "Won" sheet
or "Lost" sheet based on that indication of won/lost cell value on master
sheet.

I suggested he may need a macro in order to avoid blank lines within the
Sheet(Won) or Sheet(Lost).

Thanks,
Les
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Executing a macro

Yes a macro can be called by a cell change. The code below executes whenever
a cell in the range A1 - A10 is changed. Right click a sheet tab, view code
paste it in and try it.

Achieveing what you seem to want though would require more detail

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
MsgBox Target.Address & " Changed"
End If
End Sub

Mike

"WLMPilot" wrote:

Can a macro automatically be executed by the changing of a cell value?

I have someone who is a master sheet of data. He wants to split this sheet
based on won/lost value in a cell. The data will be moved to a "Won" sheet
or "Lost" sheet based on that indication of won/lost cell value on master
sheet.

I suggested he may need a macro in order to avoid blank lines within the
Sheet(Won) or Sheet(Lost).

Thanks,
Les

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Executing a macro

I wouldn't do this.

It can be a royal pain when the user makes a typing mistake.

Instead, I'd do all my data entry and then run a macro that did the work.

Ron de Bruin's EasyFilter addin:
http://www.rondebruin.nl/easyfilter.htm

Code from Debra Dalgleish's site:
http://www.contextures.com/excelfiles.html

Create New Sheets from Filtered List -- uses an Advanced Filter to create
separate sheet of orders for each sales rep visible in a filtered list; macro
automates the filter. AdvFilterRepFiltered.xls 35 kb

Update Sheets from Master -- uses an Advanced Filter to send data from
Master sheet to individual worksheets -- replaces old data with current.
AdvFilterCity.xls 55 kb

==========
In fact, I'd do my best not to separate the data. I'd use
data|filter|autofilter to show/hide the stuff I want to see or not.

WLMPilot wrote:

Can a macro automatically be executed by the changing of a cell value?

I have someone who is a master sheet of data. He wants to split this sheet
based on won/lost value in a cell. The data will be moved to a "Won" sheet
or "Lost" sheet based on that indication of won/lost cell value on master
sheet.

I suggested he may need a macro in order to avoid blank lines within the
Sheet(Won) or Sheet(Lost).

Thanks,
Les


--

Dave Peterson
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
Executing Macro Help [email protected] Excel Programming 7 May 1st 07 08:23 AM
executing a macro within another brian Excel Discussion (Misc queries) 3 July 5th 06 01:22 AM
Preventing macro from .xlt from executing in a .xls XxLicherxX Excel Programming 0 November 18th 05 06:34 PM
What macro is executing? Ken Loomis Excel Programming 3 October 13th 04 05:39 AM
How to abort executing macro? perfb Excel Programming 1 June 16th 04 07:15 PM


All times are GMT +1. The time now is 06:43 AM.

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"