Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA newbie needs help with triggering a macro


Hi Everybody!!!!

I need some help with a solution for running a macro that I recorded.
Just so you know recording macros is about the limit of my VBA
knowledge.

Here's my problem!!!!!
Right now I have a shortcut of ctrl f that triggers my Macro. I would
like to trigger the macro when specific cells in sheet 3 are changed.

I want to run a macro if cells $K$3, or $J$3, or $E$10, or $E$11
are changed, changed in any way (no criteria)

example:
If $K$3 is changed from true to false by a check box 83
or if $E$10 is changed from blank to "lumber" by way of Data validation
list or $E$11 is Changed from "steel" to blank

all of these events should run my macro

For your information

$K$3 is linked to Forms check box 83

$J$3 is linked to Forms checkbox 86

$E$10 has a data valitdation list in it

$E$11 has a data valitdation list in it

also I need the macro to be triggered upon entering sheet3

the macro is in module #2 and is called Macro2

Thanks for any help in advance it is really appreciated


--
mav93
------------------------------------------------------------------------
mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592
View this thread: http://www.excelforum.com/showthread...hreadid=516220

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA newbie needs help with triggering a macro

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "K3,J3,E10,E11"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Call myMacro
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"mav93" wrote in
message ...

Hi Everybody!!!!

I need some help with a solution for running a macro that I recorded.
Just so you know recording macros is about the limit of my VBA
knowledge.

Here's my problem!!!!!
Right now I have a shortcut of ctrl f that triggers my Macro. I would
like to trigger the macro when specific cells in sheet 3 are changed.

I want to run a macro if cells $K$3, or $J$3, or $E$10, or $E$11
are changed, changed in any way (no criteria)

example:
If $K$3 is changed from true to false by a check box 83
or if $E$10 is changed from blank to "lumber" by way of Data validation
list or $E$11 is Changed from "steel" to blank

all of these events should run my macro

For your information

$K$3 is linked to Forms check box 83

$J$3 is linked to Forms checkbox 86

$E$10 has a data valitdation list in it

$E$11 has a data valitdation list in it

also I need the macro to be triggered upon entering sheet3

the macro is in module #2 and is called Macro2

Thanks for any help in advance it is really appreciated


--
mav93
------------------------------------------------------------------------
mav93's Profile:

http://www.excelforum.com/member.php...o&userid=31592
View this thread: http://www.excelforum.com/showthread...hreadid=516220



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA newbie needs help with triggering a macro


Bob

Thanks a lot for the code, there are a couple of problems though

Two of the cells that trigger the macro are linked to check boxes

J3 is linked to forms check box 83
K3 is linked to forms check box 86

I'm not sure what to tell you the problem is but I do know that when I
manually typed in true or false (refering to whether or not the check
box was checked) into J3 or K3 your code worked great. So i'm assuming
that the checking the check boxes does't actually cause J3 or K3 to
change.

I'm not sure how to make the checking a forms check box a change
event?

Also, is there a way to trigger the macro each time the I enter the
sheet?

Thanks agin for any help


--
mav93
------------------------------------------------------------------------
mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592
View this thread: http://www.excelforum.com/showthread...hreadid=516220

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default VBA newbie needs help with triggering a macro

For the last part of your question
You can trigger a macro upon sheet activation
http://www.mvps.org/dmcritchie/excel/event.htm
look for Worksheet_Activate

The first part you indicated the checkmark is on a form, so
don't have an answer for you. If on a worksheet it would
be a change event and you would test the value.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"mav93" wrote in message
...

Bob

Thanks a lot for the code, there are a couple of problems though

Two of the cells that trigger the macro are linked to check boxes

J3 is linked to forms check box 83
K3 is linked to forms check box 86

I'm not sure what to tell you the problem is but I do know that when I
manually typed in true or false (refering to whether or not the check
box was checked) into J3 or K3 your code worked great. So i'm assuming
that the checking the check boxes does't actually cause J3 or K3 to
change.

I'm not sure how to make the checking a forms check box a change
event?

Also, is there a way to trigger the macro each time the I enter the
sheet?

Thanks agin for any help


--
mav93
------------------------------------------------------------------------
mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592
View this thread: http://www.excelforum.com/showthread...hreadid=516220



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
Triggering a macro after Printing Sloth Excel Programming 5 February 7th 06 05:34 PM
Triggering a macro after Printing Jim Thomlinson[_5_] Excel Programming 0 February 6th 06 09:33 PM
Function triggering a macro Leon Excel Worksheet Functions 1 December 22nd 05 07:26 AM
Daily Macro Triggering JB2010 Excel Discussion (Misc queries) 2 November 2nd 05 04:28 PM
Triggering Macro Execution Peter M[_3_] Excel Programming 1 January 12th 04 08:20 PM


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