ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel VBA Target Worksheet change (https://www.excelbanter.com/excel-discussion-misc-queries/74827-excel-vba-target-worksheet-change.html)

[email protected]

Excel VBA Target Worksheet change
 
When I cut and paste the below MS excel macro into a new workbook
module sheet, it does not work?

I type the y in column c, this macro will not work...

Please help...



Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Column = 3 Then

If (Target.Text = "y") Then

MsgBox "hello"

End If
End If

End Sub


Dave Peterson

Excel VBA Target Worksheet change
 
This kind of code goes behind the worksheet.

If you rightclick on the worksheet tab that should have this behavior, you can
select view code.

Paste the code in that code window that just opened up.



wrote:

When I cut and paste the below MS excel macro into a new workbook
module sheet, it does not work?

I type the y in column c, this macro will not work...

Please help...

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Column = 3 Then

If (Target.Text = "y") Then

MsgBox "hello"

End If
End If

End Sub


--

Dave Peterson


All times are GMT +1. The time now is 02:59 PM.

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