Activating macro on enter.

P

Priya Gautam

Hello,

I have a macro that takes the criteria from a cell A1 of a sheet. Here i
enter the criteria in the cell and then Run the macro.
Is there a way by which I can make the macro run once I input the criteria
in cell A1 and perss Enter button?

Thanks,

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...dg=microsoft.public.excel.worksheet.functions
 
J

Jarek Kujawa

here is what I suggest

1. go to Tools->Options->Edit and uncheck ENTER settings
2. right-click on worksheet tab and choose 'View code'
3. in a 2nd from right window you should see '(General)', select
Worksheet
4. select SelectionChange on the right

put the following code there:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
k = Target.Address
If k = "$A$1" And Target.Value = "abc" Then
Call 'my macro'
End If
End Sub

HIH
 
P

Priya Gautam

Thank you Jarek!

Jarek Kujawa said:
here is what I suggest

1. go to Tools->Options->Edit and uncheck ENTER settings
2. right-click on worksheet tab and choose 'View code'
3. in a 2nd from right window you should see '(General)', select
Worksheet
4. select SelectionChange on the right

put the following code there:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
k = Target.Address
If k = "$A$1" And Target.Value = "abc" Then
Call 'my macro'
End If
End Sub

HIH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top