ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel macro - macro initiation upon hitting the ener key (https://www.excelbanter.com/excel-programming/296631-excel-macro-macro-initiation-upon-hitting-ener-key.html)

arunjoshi[_2_]

excel macro - macro initiation upon hitting the ener key
 
(a) how can i get a macro activated automatically when the enter key i
hit in a partcular cell, say a1.

(b) how can i get a macro activated automatically when a particula
value (abc) is entered in a particular cell (a1) and then the enter ke
is hit

--
Message posted from http://www.ExcelForum.com


Frank Kabel

excel macro - macro initiation upon hitting the ener key
 
Hi
use the worksheet_change event for this. See
http://www.cpearson.com/excel/events.htm

In your case use something like
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Application.Intersect(Target, Range("A1")) Is Nothing Then _
Exit Sub
If Target.Cells.Count 1 Then Exit Sub

With Target
If .Value = "" Then
msgbox "Empty cell entered"
elseif .value="abc" then
msgbox "abc entered"
End If
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"arunjoshi " schrieb im
Newsbeitrag ...
(a) how can i get a macro activated automatically when the enter key

is
hit in a partcular cell, say a1.

(b) how can i get a macro activated automatically when a particular
value (abc) is entered in a particular cell (a1) and then the enter

key
is hit.


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com