View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Place a character in a cell

You could use a user defined function:

Option Explicit
Function CellHasComment(rng As Range) As Boolean
Application.Volatile
CellHasComment = Not (CBool(rng.Cells(1).Comment Is Nothing))
End Function


This function may be one calculation behind. It won't update if you add a
comment. But should reflect the right answer once excel recalcs.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

========
Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=cellhascomment(a1)
Where A1 contains a comment (or not).

Then if that works, try:
=IF(CellHasComment(A1),"*","")


Lisa38 wrote:

I am trying to write a formula that will cause an asterisk to appear in one
cell if another cell has a comment in it. How do I do this?

Thanks,


--

Dave Peterson