View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Help with syntax on IF-Then for CellComment

Try this:

If Not ActiveCell.Comment Is Nothing Then
TextBox8.Value = ActiveCell.Comment.Text

"excelnut1954" wrote:

I have a macro that will run when the user clicks a button to Find a
Record. He enters a PO#, and all the fields for that record will appear
on a UserForm.
Everything works well, except that one of the textboxes is for any cell
comment in one of the fields.

The UserForm will display the cell comment OK, but if there is no cell
comment in that cell, then there is an error.

So, I want to add a line of code that will test if there IS any cell
comment. If there is, then it can be entered in TextBox8. There is no
need for an Else part of the statement. Here is what I have now....

If Comment.Text = True Then
TextBox8.Value = ActiveCell.Comment.Text

End If

It worked ok until I attempted to incorporate an IF-Then statement.
I'm sure it's the 1st line that is the problem. I'm guessing on
the syntax. Comment.Text = True

The 2nd line works ok by itself. (When there IS a cell comment
available)

Any suggestions?

Thanks,
J.O.