Hi im after a simple bit of code so that when i enter the number 6111 in a certain colunm, say colunm A:A that the cell that 6111 is entered will automaticly show a comment box saying "Attention"
Shouldnt be hard for you guys?
Cheers
Sane
Hi im after a simple bit of code so that when i enter the number 6111 in a certain colunm, say colunm A:A that the cell that 6111 is entered will automaticly show a comment box saying "Attention"
Shouldnt be hard for you guys?
Cheers
Sane
use this in the code page of the desired sheet
![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Value = 6111 Then Target.AddComment ("Attention") End Sub
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- Mark your post SOLVED if it has been answered satisfactorily:
- Select Thread Tools (on top of your 1st post)
- Select Mark this thread as Solved
Worksheet event code is stored on a worksheet module. To add it to your worksheet, do the following:
Copy the code
Select the worksheet in which you the code to run
Right click on the sheet tab and choose View Code, to open the Visual Basic Editor.
Where the cursor is flashing, choose Edit | Paste
Here is the code.
![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Column <> 1 Then Exit Sub If Target = "6111" Then With Target .ClearComments .AddComment .Comment.Visible = False .Comment.Text Text:="What the HECK!!" .Comment.Shape.TextFrame.AutoSize = True End With Else: Target.ClearComments End If End Sub
use this instead of my previous code
![]()
Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next If Target.Value = 6111 Then Target.AddComment ("Attention") ElseIf Target.Comment.Text = "Attention" Then Target.ClearComments End If End Sub
Last edited by Kelshaer; 03-07-2012 at 10:27 AM.
DaveExcel: Thanks, I just missed it
![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column <> 1 or Target.Count > 1 Then Exit Sub On Error Resume Next If Target.Value = 6111 Then Target.AddComment ("Attention") ElseIf Target.Comment.Text = "Attention" Then Target.ClearComments End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks