PC Review


Reply
Thread Tools Rate Thread

Automatically change cell comments

 
 
=?Utf-8?B?TWFyY3VzIEI=?=
Guest
Posts: n/a
 
      28th Mar 2007
Hi,

I have a range of cells where the user will be able to select an option code
from a data validation list.

I would like to be able to automatically update cell comments to provide a
usefull description depending on which option code has been selected from the
validation list.

I have the following code which works for a single cell and updates the
referenced comment for that cell.

How can I change this so it will work for any cell within a specified range
and update the comment for that cell ?

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F2")) Is Nothing Then
If Target.Value = "RM4" Then
Comments(1).Text Target & " " & Sheet4.Range("C4")
ElseIf Target.Value = "RM5" Then
Comments(1).Text Target & " " & Sheet4.Range("C6")
ElseIf Target.Value = "" Then
Comments(1).Text "Selection Required"
End If
End If
end sub

thanks,
Marcus

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      28th Mar 2007
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("F2:F10")) Is Nothing Then
If Target.Value = "RM4" Then
Target.Comment.Text Target & " " & Sheet4.Range("C4")
ElseIf Target.Value = "RM5" Then
Target.Comment.Text Target & " " & Sheet4.Range("C6")
ElseIf Target.Value = "" Then
Target.Comment.Text "Selection Required"
End If
End If
End Sub

Works, but assumes the comment for the cell already exists.

--
Regards,
Tom Ogilvy


"Marcus B" wrote:

> Hi,
>
> I have a range of cells where the user will be able to select an option code
> from a data validation list.
>
> I would like to be able to automatically update cell comments to provide a
> usefull description depending on which option code has been selected from the
> validation list.
>
> I have the following code which works for a single cell and updates the
> referenced comment for that cell.
>
> How can I change this so it will work for any cell within a specified range
> and update the comment for that cell ?
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Not Intersect(Target, Range("F2")) Is Nothing Then
> If Target.Value = "RM4" Then
> Comments(1).Text Target & " " & Sheet4.Range("C4")
> ElseIf Target.Value = "RM5" Then
> Comments(1).Text Target & " " & Sheet4.Range("C6")
> ElseIf Target.Value = "" Then
> Comments(1).Text "Selection Required"
> End If
> End If
> end sub
>
> thanks,
> Marcus
>

 
Reply With Quote
 
=?Utf-8?B?TWFyY3VzIEI=?=
Guest
Posts: n/a
 
      28th Mar 2007
Worked a charm

thanks,
Marcus

"Tom Ogilvy" wrote:

> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Count > 1 Then Exit Sub
> If Not Intersect(Target, Range("F2:F10")) Is Nothing Then
> If Target.Value = "RM4" Then
> Target.Comment.Text Target & " " & Sheet4.Range("C4")
> ElseIf Target.Value = "RM5" Then
> Target.Comment.Text Target & " " & Sheet4.Range("C6")
> ElseIf Target.Value = "" Then
> Target.Comment.Text "Selection Required"
> End If
> End If
> End Sub
>
> Works, but assumes the comment for the cell already exists.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Marcus B" wrote:
>
> > Hi,
> >
> > I have a range of cells where the user will be able to select an option code
> > from a data validation list.
> >
> > I would like to be able to automatically update cell comments to provide a
> > usefull description depending on which option code has been selected from the
> > validation list.
> >
> > I have the following code which works for a single cell and updates the
> > referenced comment for that cell.
> >
> > How can I change this so it will work for any cell within a specified range
> > and update the comment for that cell ?
> >
> > Private Sub Worksheet_Change(ByVal Target As Range)
> > If Not Intersect(Target, Range("F2")) Is Nothing Then
> > If Target.Value = "RM4" Then
> > Comments(1).Text Target & " " & Sheet4.Range("C4")
> > ElseIf Target.Value = "RM5" Then
> > Comments(1).Text Target & " " & Sheet4.Range("C6")
> > ElseIf Target.Value = "" Then
> > Comments(1).Text "Selection Required"
> > End If
> > End If
> > end sub
> >
> > thanks,
> > Marcus
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically change cell colors based on date in cell Greg Microsoft Excel Misc 1 27th Jan 2009 05:53 PM
How to change shapes for Cell Comments Jan T. Microsoft Excel Misc 3 15th Dec 2008 11:10 PM
Automatically create comments based upon cell value and related datain database dladilaco@gmail.com Microsoft Excel Misc 3 10th Apr 2008 12:31 PM
fill cell comments automatically =?Utf-8?B?QW5kcmV3?= Microsoft Excel Programming 1 5th Jun 2007 04:52 AM
Can Comments be automatically converted to text cell values? =?Utf-8?B?dG9tZG9nNjE=?= Microsoft Excel Misc 1 23rd Jan 2005 09:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 AM.