need specialist eye for the following macros.

Mayk

New Member
Joined
Mar 18, 2002
Messages
18
Macro i used to insert commentbox is:
Sub Button25_Click()
'
' Button25_Click Macro
' Macro recorded 11/04/2002 by Radek Ilendo
'

'
Range("I12").Select
Range("I12").AddComment
Range("I12").Comment.Visible = True
Range("I12").Comment.Text Text:="1." & Chr(10) & "2." & Chr(10) & "3." & Chr(10) & ""
Range("I12").Select
ActiveCell.Comment.Visible = False
Range("I13").Select
End Sub

The problem i have is with the second line:
Range("I12").AddComment
as it is always requires debuging and makes macro not working i dunno wot is going wrong.

Could any1 help.
This is one of my latest step to finish my project
luckily.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I would assume that since you are "Select"-ing the cell, you don't need to to use Rang("I12") at all, you could just use "Selection".

<pre>
Posted: 2002-04-11 13:18
--------------------------------------------------------------------------------
Macro i used to insert commentbox is:
Sub Button25_Click()
'
' Button25_Click Macro
' Macro recorded 11/04/2002 by Radek Ilendo
'

'
Range("I12").Select
Selection.AddComment
Selection.Comment.Visible = True
Selection.Comment.Text Text:="1." & Chr(10) & "2." & Chr(10) & "3." & Chr(10) & ""
'Range("I12").Select
ActiveCell.Comment.Visible = False
Range("I13").Select
End Sub </pre>


HTH
 
Upvote 0
Mark
Selection.AddComment
doesnt change anything code is still frozen and reqiures debuging.
thnx 4 help
any1 with anymore ideas?
pls.
 
Upvote 0
I didn't test the code.

What error are you getting? i.e. why is it telling you that it needs debugging?

You're original code works for me. What version of Excel are you using? I've got XL2000.
_________________<font color = green> Mark O'Brien
This message was edited by Mark O'Brien on 2002-04-11 13:37
 
Upvote 0
run-time error '1004':
application-defined or object-defined error


dis drives me mad:)
im using excel 2000 as well
i dunno wot may go wrong all i have problem with is that second line
Selection.AddComment or
my version
Range("I12").AddComment

anything else u could suggest
pls
 
Upvote 0
begging for help//



maybe any1 could suggest their own macro to input the commentbox into a specified cell.
 
Upvote 0
Hi,

I assume that you are getting an error because you are trying to add a comment to a cell that already contains a comment.

I don't see a .HasComment property, but the following should resolve your problem...

------------------
With Range("I12")
.ClearComments
.AddComment
.Comment.Text Text:="1." & Chr(10) & "2." & Chr(10) & "3." & Chr(10) & ""
.Comment.Visible = True
End With
------------------

If you don't want to show the comment, take the last line out (the default is false so the line is not needed).

HTH,
Jay
 
Upvote 0
This worked for me;

<pre/>

Private Sub CommandButton1_Click()

With ActiveCell
On Error Resume Next
.Comment.Delete
On Error GoTo 0
.AddComment
.Comment.Text Text:="1." & Chr(10) & "2." & Chr(10) & "3." & Chr(10) & ""
End With

End Sub

</pre>
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top