i have made a spreadsheet on weight. i want a comment to come up if a certain number is entered. eg if number is less than 100, i want a comment to come up saying well done.
Try this: right click the sheet tab, select View code and paste in
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then 'C
If Target.Value < 100 Then MsgBox "Well done", vbExclamation
End If
End Sub
Change the 3 to the number of the column that weights are entered in.
Im not sure what you mean by event code but i went onto the spreadsheet, right-clicked and pressed view code. this came up with an empty box called Sheet1 (Code). i pasted the thing you gave me and changed the column thing where you wrote 3 to the right letter. then i losed it and tried typing a few numbers on the spreadsheet but nothing came up, have i missed something out?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then 'C
If Target.Value > 50 And Target.Value < 100 Then MsgBox "Well done", vbExclamation
End If
End Sub
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.