display comment based on cell value

M

milehigh

Hi All,

I know about conditional formatting - I was wondering if
there is a way to display text based on a value - without
using an IF formula? Any ideas. Thanks in advance.
 
F

Frank Kabel

Hi
where do you want do display the text?. If you want this text to be
included in the same or adjacent cell you have to use VBA (e.g. the
worksheet_change event). To give an example:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub
On Error GoTo CleanUp:
With Target
If .Value <> "" Then
Application.EnableEvents = False
.offset(0,1).value = "Text intered in column A"
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub
 
G

Guest

Hi Frank,

Thanks for the help - I want the text to display in the
same cell - I only want the text to display if the cell
displays "PD" (this is based on a different formula. I
am not sure how I would enter the below information into
a cell - I would greatly appreciate it if you could give
me some additional information about entering a VBA
routine into a worksheet. Thanks.
 
F

Frank Kabel

Hi
and what should happen with the old value (overwritten, e.g.).
Especially if the old value is calculated by a formula how should your
text be inserted?
Though it is possible to add your text to the value in this cell (e.g.
create something like: "FLAG: PD") your formula won't work

So please provide more details what you're trying to achieve
Frank
 
G

Guest

Hi again,

I really appreciate your help.

Here is the formula that is in the cell (there may be an
easier way to do this but I am not sure - this works
anyway):

=IF((OR(S33="PD",S34="PD",R35="PD")),"PD",(IF(AND
(S33="SD",S34<>"PD"),"SD",IF(AND(S33="PR",S34<>"PD"),"PR",
(IF(AND(S33="CR",S34="INCOMPLETE/SD"),"PR",IF(AND
(S33="CR",S34="CR"),"CR","")))))))

This formula is for all cells D - AC in row 35 - It
doesn't matter to me if the data is overwritten - because
I can just reinsert "PD - blah, blah" with my comment.

Thanks again in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top