adding comments

mvhh

New Member
Joined
Apr 24, 2011
Messages
14
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.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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.
 
Upvote 0
i tried it but nothing is coming up. i have checked it is definitely the right comment but it doesnt seem to work. any other things i could try?
 
Upvote 0
Did you place the code in the sheet's code module as I explained? It is event code that will not work in a standard module.
 
Upvote 0
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?
 
Upvote 0
Try like this

Code:
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
 
Upvote 0
it has come up with 'compile error. ambiguous name detected: worhsheet_change' have i typed something wrong?
 
Upvote 0
You need to replace the original code with the one that I posted above (that checks for weights between 50 and 100).
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

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.
Go back
Back
Top