![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Location: rejdus@hotmail.com
Posts: 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. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
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".
HTH |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Location: rejdus@hotmail.com
Posts: 18
|
Mark
Selection.AddComment doesnt change anything code is still frozen and reqiures debuging. thnx 4 help any1 with anymore ideas? pls. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
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. _________________ [b] Mark O'Brien [ This Message was edited by: Mark O'Brien on 2002-04-11 13:37 ] |
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Location: rejdus@hotmail.com
Posts: 18
|
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 |
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Location: rejdus@hotmail.com
Posts: 18
|
begging for help//
maybe any1 could suggest their own macro to input the commentbox into a specified cell. |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
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 |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
This worked for me;
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|