Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Place a character in a cell

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,
  #2   Report Post  
Posted to microsoft.public.excel.misc
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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Place a character in a cell

Thank you so much, Dave. You are a big help!!

Lisa

"Dave Peterson" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to place a checkbox in the middle of a cell, yet I want thecheckboxArea take up the entire cell. Leonid L Excel Discussion (Misc queries) 2 July 30th 08 04:25 PM
Automatically place text in one cell into cell in another sheet Jack Frost New Users to Excel 2 April 13th 07 03:11 AM
place text in one cell cmmssmith Excel Worksheet Functions 3 March 30th 06 11:09 PM
How to place a value in another cell BobG Excel Discussion (Misc queries) 2 February 4th 06 01:02 PM
lookup specific character place Budwho Excel Worksheet Functions 6 July 20th 05 06:59 PM


All times are GMT +1. The time now is 08:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"