ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If event When a specific cell changes (https://www.excelbanter.com/excel-programming/370868-if-event-when-specific-cell-changes.html)

nuclearjack

If event When a specific cell changes
 

Hello

I have a workbook that is shared with many users and it can NOT be
password protected but I want to control the data in cells F45 and G45.
The VB I have works for F45 but I cant duplicate it for cell G45


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target = Cells(45, 6) Then Cells(45, 6) = "n/a"
End Sub

Currently when ever someone enters anything in cell F45 it changes back
to n/a as soon as they press enter.


--
nuclearjack
------------------------------------------------------------------------
nuclearjack's Profile: http://www.excelforum.com/member.php...o&userid=13355
View this thread: http://www.excelforum.com/showthread...hreadid=573346


[email protected]

If event When a specific cell changes
 
Hi,
Try this :
I've modified this from Ogilvy code :
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Address = "$F$45" Then
If Target.Value < "n/a" Then Target.Value = "n/a"
End If
End Sub

or have a look at :
http://groups.google.co.id/group/mic...0a588ace130544

Rgds,

halim

nuclearjack menuliskan:
Hello

I have a workbook that is shared with many users and it can NOT be
password protected but I want to control the data in cells F45 and G45.
The VB I have works for F45 but I cant duplicate it for cell G45


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target = Cells(45, 6) Then Cells(45, 6) = "n/a"
End Sub

Currently when ever someone enters anything in cell F45 it changes back
to n/a as soon as they press enter.


--
nuclearjack
------------------------------------------------------------------------
nuclearjack's Profile: http://www.excelforum.com/member.php...o&userid=13355
View this thread: http://www.excelforum.com/showthread...hreadid=573346




All times are GMT +1. The time now is 02:37 AM.

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