Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
j8f j8f is offline
external usenet poster
 
Posts: 4
Default How do I get a macro to run automatically when a specific value i.

I want a macro to run automaticaly when I enter a specific value in a
specific cell on a specific worksheet
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default How do I get a macro to run automatically when a specific value i.

You have to put the macro in the Worksheet_Change event (in the specific
worksheeet's code module):

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(SpecificCell)) Is Nothing Then
If Range(SpecficCell) = SpecificValue Then
'your macro steps
End If
End If
End Sub

--

Vasant


"j8f" wrote in message
...
I want a macro to run automaticaly when I enter a specific value in a
specific cell on a specific worksheet



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How do I get a macro to run automatically when a specific value i.

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$H$1" Then
myMacro
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

RP
(remove nothere from the email address if mailing direct)


"j8f" wrote in message
...
I want a macro to run automaticaly when I enter a specific value in a
specific cell on a specific worksheet



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How do I get a macro to run automatically when a specific valu

if I want to run it automatically in works sheet, Can I use this way ?

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$H$1" Then
myMacro
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

RP
(remove nothere from the email address if mailing direct)


"j8f" wrote in message
...
I want a macro to run automaticaly when I enter a specific value in a
specific cell on a specific worksheet




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How do I get a macro to run automatically when a specific valu

At least try it and see.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Microlong" wrote in message
...
if I want to run it automatically in works sheet, Can I use this way ?

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$H$1" Then
myMacro
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

RP
(remove nothere from the email address if mailing direct)


"j8f" wrote in message
...
I want a macro to run automaticaly when I enter a specific value in a
specific cell on a specific worksheet








  #6   Report Post  
Posted to microsoft.public.excel.programming
j8f j8f is offline
external usenet poster
 
Posts: 4
Default How do I get a macro to run automatically when a specific valu

First of all thanks for your help. Although this code works its not quite
what I was looking for, I will try to explain in more detail. Cell B1 is
linked as a list to a list of names on another worksheet, when you select one
of the names from the list, it automatically changes the value in cell B2, to
a value between the numbers 226 and 300, using a lookup formula again this
is refering to a list on the other worksheet. it is when this value changes
I want the macro to run. The macro is for the purpose of selecting various
custom views which relate to the value chosen in cell B2. I hope this
explains my problem and you or someone out there has a soloution.

"Vasant Nanavati" wrote:

You have to put the macro in the Worksheet_Change event (in the specific
worksheeet's code module):

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(SpecificCell)) Is Nothing Then
If Range(SpecficCell) = SpecificValue Then
'your macro steps
End If
End If
End Sub

--

Vasant


"j8f" wrote in message
...
I want a macro to run automaticaly when I enter a specific value in a
specific cell on a specific worksheet




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
specific macro on specific sheets Harshad[_2_] Excel Discussion (Misc queries) 5 October 20th 08 07:26 AM
Highlight automatically a specific cell Frances Holden[_2_] Excel Worksheet Functions 1 January 7th 08 03:05 PM
Only calculate specific worksheet automatically? qflyer Excel Worksheet Functions 1 June 27th 05 09:52 PM
Automatically Put a Value in a specific cell. Shawn Excel Discussion (Misc queries) 2 May 23rd 05 09:05 PM
how do I automatically run a macro when a specific value is enter. j8f Excel Programming 0 March 1st 05 08:07 PM


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