ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excuting marco on entering data into a field (https://www.excelbanter.com/excel-programming/292797-excuting-marco-entering-data-into-field.html)

pauluk[_5_]

Excuting marco on entering data into a field
 
Hi,

Is there any way that i can excute a macro form entering data into a
field?

i.e. upon entering the word cancelled in to a cell in column G the
cells for that row in columns N to T automaticlly filled with N/A

I have used the the lookup formula but i need it as a macro

Regards
Paul


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


Tom Ogilvy

Excuting marco on entering data into a field
 
Use the worksheet change event

Test for the condition

see Chip Pearson's page on events

http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy

"pauluk " wrote in message
...
Hi,

Is there any way that i can excute a macro form entering data into a
field?

i.e. upon entering the word cancelled in to a cell in column G the
cells for that row in columns N to T automaticlly filled with N/A

I have used the the lookup formula but i need it as a macro

Regards
Paul


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




Bob Phillips[_6_]

Excuting marco on entering data into a field
 
Hi Paul,

Here's some code

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Target.Column = 7 Then
If LCase(Target.Value) = "cancelled" Then
Cells(Target.Row, "N").Resize(1, 7).Value = "NA"
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub

Put it in the workshneet module (right-click the sheet name tab, click View
Code, and paste the code).

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"pauluk " wrote in message
...
Hi,

Is there any way that i can excute a macro form entering data into a
field?

i.e. upon entering the word cancelled in to a cell in column G the
cells for that row in columns N to T automaticlly filled with N/A

I have used the the lookup formula but i need it as a macro

Regards
Paul


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





All times are GMT +1. The time now is 10:35 AM.

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