Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Excel code to call a macro when a certain value in a cell isselected.

I am trying to write code that will call a macro when the value of
cell is equal to a defined text.

Example:

If C28 = "Remind", then Call Macro_Name.

Can anyone help?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Excel code to call a macro when a certain value in a cell is selec

From Google:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value 10 Then
MsgBox "Put your macro code here in place of the MsgBox line"
End If
End If
End Sub


Regards,
Ryan--


--
RyGuy


" wrote:

I am trying to write code that will call a macro when the value of
cell is equal to a defined text.

Example:

If C28 = "Remind", then Call Macro_Name.

Can anyone help?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel code to call a macro when a certain value in a cell is selected.

How does C28 get to be "Remind"?

I will assume a calculated formula.

Private Sub Worksheet_Calculate()
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("C28")
If .Value = "remind" Then
Call Macroname
End If
End With
stoppit:
Application.EnableEvents = True
End Sub

The is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that module.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 10:16:10 -0800 (PST), wrote:

I am trying to write code that will call a macro when the value of
cell is equal to a defined text.

Example:

If C28 = "Remind", then Call Macro_Name.

Can anyone help?

Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Excel code to call a macro when a certain value in a cell isselected.

On Feb 15, 12:14*pm, Gord Dibben <gorddibbATshawDOTca wrote:
How does C28 get to be "Remind"?

I will assume a calculated formula.

Private Sub Worksheet_Calculate()
*On Error GoTo stoppit
* *Application.EnableEvents = False
* *With Me.Range("C28")
* *If .Value = "remind" Then
* * * * * *Call Macroname
*End If
End With
stoppit:
Application.EnableEvents = True
End Sub

The is sheet event code. *Right-click on the sheet tab and "View Code"

Copy/paste into that module.

Gord Dibben *MS Excel MVP



On Fri, 15 Feb 2008 10:16:10 -0800 (PST), wrote:
I am trying to write code that will call a macro when the value of
cell is equal to a defined text.


Example:


If C28 *= "Remind", then Call Macro_Name.


Can anyone help?


Thanks!- Hide quoted text -


- Show quoted text -


Thanks Gord! That worked :)
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel code to call a macro when a certain value in a cell is selected.

Good to hear.

Thanks for the feedback

On Fri, 15 Feb 2008 12:08:15 -0800 (PST), wrote:

Thanks Gord! That worked :)


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
Can you call a Web Service from Excel 2007 without writing code? BigBadBubba Excel Discussion (Misc queries) 0 March 14th 07 03:32 AM
How can I call My Computer through an Excel macro? SAM SEBAIHI Excel Discussion (Misc queries) 0 February 24th 07 02:07 AM
Can I call a macro from ouside excel? DannyS Excel Discussion (Misc queries) 2 January 22nd 07 05:51 PM
how can i call sub or function in vba code xxx Excel Discussion (Misc queries) 3 June 28th 06 11:47 AM
Using PowerPoint to Call Excel/Macro? Losse Excel Discussion (Misc queries) 0 July 20th 05 03:00 PM


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