Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Invoke Macro on entering data in column

Hi all
Getting a bit frustrated with this. Using Excel 2007.
I have a worksheet "CallList" with Column P named "Lead"
I am attempting to invoke a "Sort"macro automatically that would be
triggered by the insertion of data into Column P. Unsure of code to call
macro from VBA. I think its should be invoked from the worksheet module. This
macro will be stored in Personal workbook but I need to be able to import it
into a number of different workbooks each week.
Any help would be appreciated.

Thanks very much!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Invoke Macro on entering data in column

Insert the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set p = Range("P:P")
If Intersect(t, p) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call mySort
Application.EnableEvents = True
End Sub


mySort can be in either the worksheet code area or a public module.
--
Gary''s Student - gsnu200827


"GeorgeR" wrote:

Hi all
Getting a bit frustrated with this. Using Excel 2007.
I have a worksheet "CallList" with Column P named "Lead"
I am attempting to invoke a "Sort"macro automatically that would be
triggered by the insertion of data into Column P. Unsure of code to call
macro from VBA. I think its should be invoked from the worksheet module. This
macro will be stored in Personal workbook but I need to be able to import it
into a number of different workbooks each week.
Any help would be appreciated.

Thanks very much!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Invoke Macro on entering data in column

Hi GS
Thanks for the input. However after pasting your code I get a variable not
defined at "t" "set t as target.

"Gary''s Student" wrote:

Insert the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set p = Range("P:P")
If Intersect(t, p) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call mySort
Application.EnableEvents = True
End Sub


mySort can be in either the worksheet code area or a public module.
--
Gary''s Student - gsnu200827


"GeorgeR" wrote:

Hi all
Getting a bit frustrated with this. Using Excel 2007.
I have a worksheet "CallList" with Column P named "Lead"
I am attempting to invoke a "Sort"macro automatically that would be
triggered by the insertion of data into Column P. Unsure of code to call
macro from VBA. I think its should be invoked from the worksheet module. This
macro will be stored in Personal workbook but I need to be able to import it
into a number of different workbooks each week.
Any help would be appreciated.

Thanks very much!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Invoke Macro on entering data in column

Thanks Gary's Student I removed option Explicit and it works great

"Gary''s Student" wrote:

Insert the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set p = Range("P:P")
If Intersect(t, p) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call mySort
Application.EnableEvents = True
End Sub


mySort can be in either the worksheet code area or a public module.
--
Gary''s Student - gsnu200827


"GeorgeR" wrote:

Hi all
Getting a bit frustrated with this. Using Excel 2007.
I have a worksheet "CallList" with Column P named "Lead"
I am attempting to invoke a "Sort"macro automatically that would be
triggered by the insertion of data into Column P. Unsure of code to call
macro from VBA. I think its should be invoked from the worksheet module. This
macro will be stored in Personal workbook but I need to be able to import it
into a number of different workbooks each week.
Any help would be appreciated.

Thanks very much!!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Invoke Macro on entering data in column

Better yet would have been to leave the Option Explicit statement in and
just declare the variables the Gary''s Student left out; namely, Dim both t
and p as Range.

--
Rick (MVP - Excel)


"GeorgeR" wrote in message
...
Thanks Gary's Student I removed option Explicit and it works great

"Gary''s Student" wrote:

Insert the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set p = Range("P:P")
If Intersect(t, p) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call mySort
Application.EnableEvents = True
End Sub


mySort can be in either the worksheet code area or a public module.
--
Gary''s Student - gsnu200827


"GeorgeR" wrote:

Hi all
Getting a bit frustrated with this. Using Excel 2007.
I have a worksheet "CallList" with Column P named "Lead"
I am attempting to invoke a "Sort"macro automatically that would be
triggered by the insertion of data into Column P. Unsure of code to
call
macro from VBA. I think its should be invoked from the worksheet
module. This
macro will be stored in Personal workbook but I need to be able to
import it
into a number of different workbooks each week.
Any help would be appreciated.

Thanks very much!!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Invoke Macro on entering data in column

Thanks Rick
Will give it a try.

"Rick Rothstein" wrote:

Better yet would have been to leave the Option Explicit statement in and
just declare the variables the Gary''s Student left out; namely, Dim both t
and p as Range.

--
Rick (MVP - Excel)


"GeorgeR" wrote in message
...
Thanks Gary's Student I removed option Explicit and it works great

"Gary''s Student" wrote:

Insert the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set p = Range("P:P")
If Intersect(t, p) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call mySort
Application.EnableEvents = True
End Sub


mySort can be in either the worksheet code area or a public module.
--
Gary''s Student - gsnu200827


"GeorgeR" wrote:

Hi all
Getting a bit frustrated with this. Using Excel 2007.
I have a worksheet "CallList" with Column P named "Lead"
I am attempting to invoke a "Sort"macro automatically that would be
triggered by the insertion of data into Column P. Unsure of code to
call
macro from VBA. I think its should be invoked from the worksheet
module. This
macro will be stored in Personal workbook but I need to be able to
import it
into a number of different workbooks each week.
Any help would be appreciated.

Thanks very much!!



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
transfering data in another column entering more sorted data Kevin - Corporate Services Excel Worksheet Functions 0 August 6th 08 09:23 PM
Entering Data into Column C based on word from Column A J.J. Excel Programming 5 April 18th 07 08:50 PM
how to move the cursor to column A after entering data column F tskaiser New Users to Excel 2 April 29th 06 02:28 PM
add data to combo box in excel then invoke macro Richard Excel Worksheet Functions 1 December 11th 05 08:50 PM
How do you Stop Entering Duplicate Data in a Column? Satraj Excel Worksheet Functions 7 November 4th 05 01:04 PM


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