Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding Comment to cell

I have dabbled in programming and have checked out what other have sent, but I am still having problems getting all of it to work. Here is my problem

I have a range of cell, B6, D6, F6, H,6, J6, L6, N6, P6 which I have made into a range. (This range will most likely be extended to cover rows 6-41 if possible) I would like to be able to create a macro that check the active cell within that range and see if a comment exitsts, if it does not, then pop open a textbox for adding a comment

I have a macro that works on a specified cell but not from a range. I know this is over my head but this is how we learn, is it not? Any help will always be much appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Adding Comment to cell

Troy
You can use the following to look at each cell in YourRange.
Dim i As Range
For Each i In YourRange
'What you want to do
Next i

Within this loop you can use the following to determine if that cell has a
comment:
If i.Comment Is Nothing Then.............
The argument in the above If statement is True if the cell has no
comment.
You can get the opposite with:
If Not i.Comment Is Nothing Then...............

Still within the same loop, you can then use an InputBox statement to
type in the comment you want, like:
MyComment=InputBox................

Then the following statement will put that comment in that cell.
i.AddComment text:=MyComment

I purposely didn't put all the above together nice and neat for
you because you seemed interested in learning. This will give you something
to chew on for a while. Post back if you need more. HTH Otto


"Troy H" wrote in message
...
I have dabbled in programming and have checked out what other have sent,

but I am still having problems getting all of it to work. Here is my
problem.

I have a range of cell, B6, D6, F6, H,6, J6, L6, N6, P6 which I have made

into a range. (This range will most likely be extended to cover rows 6-41 if
possible) I would like to be able to create a macro that check the active
cell within that range and see if a comment exitsts, if it does not, then
pop open a textbox for adding a comment.

I have a macro that works on a specified cell but not from a range. I know

this is over my head but this is how we learn, is it not? Any help will
always be much appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding Comment to cell

Thank you for your reply, it will definately help in getting this resolved

With my lack of understaning also comes my lack of presenting the whole picture. I would like the macro to kick in after a user enters a number into a cell

I was thinking of a single program that would solve my purpose. A user would enter a cell in the range created, and input a number, if there is no comment attached to the cell, then a box would pop up for the user to input information if needed

Does this shed more light on my question

Thanks again for your response

----- Troy H wrote: ----

I have dabbled in programming and have checked out what other have sent, but I am still having problems getting all of it to work. Here is my problem

I have a range of cell, B6, D6, F6, H,6, J6, L6, N6, P6 which I have made into a range. (This range will most likely be extended to cover rows 6-41 if possible) I would like to be able to create a macro that check the active cell within that range and see if a comment exitsts, if it does not, then pop open a textbox for adding a comment

I have a macro that works on a specified cell but not from a range. I know this is over my head but this is how we learn, is it not? Any help will always be much appreciated.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Adding Comment to cell

Hi Troy,
You probably want your macro that Otto started you
off with information on how to write the macro to first bring
what you have up to date.

Then for updating you will want an Event Macro.
http://www.mvps.org/dmcritchie/excel/event.htm

If you have your comment indicators turned on, it not much
problem to see which cells have or do not have comments
and to see or add them accordingly if his is jus for one sheet
and you're not constantly adding/changing comments...
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Adding Comment to cell

Try
Yes, that is another wrinkle in the task. You would need an event macro
that is triggered to run if any change is made to any cell in the entire
sheet. The code within this macro would then check to see if the Target
cell (the cell that was changed) lies within your range. If it does, call
the macro that does the comment task. If it doesn't, do nothing.
This event macro is a sheet macro. That means it applies to only that
specific sheet. You will have to place this macro in the sheet module for
that sheet. Post back if you need help with this. The macro would look
like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target = "" Then Exit Sub
If Not Intersect(Target, YourRange) Is Nothing Then _
Call YourCommentMacro(Range(Target.Address))
End Sub

Note that you are passing the Target cell to YourCommentMacro in the above
macro call. This means that YourCommentMacro would have to look like this:
Sub YourCommentMacro(TheCell As Range)
'Your code for putting a comment in TheCell
End Sub

Remember that the more questions you ask, the more you learn. HTH Otto
"Troy H" wrote in message
...
Thank you for your reply, it will definately help in getting this

resolved.

With my lack of understaning also comes my lack of presenting the whole

picture. I would like the macro to kick in after a user enters a number into
a cell.

I was thinking of a single program that would solve my purpose. A user

would enter a cell in the range created, and input a number, if there is no
comment attached to the cell, then a box would pop up for the user to input
information if needed.

Does this shed more light on my question?

Thanks again for your response.

----- Troy H wrote: -----

I have dabbled in programming and have checked out what other have

sent, but I am still having problems getting all of it to work. Here is my
problem.

I have a range of cell, B6, D6, F6, H,6, J6, L6, N6, P6 which I have

made into a range. (This range will most likely be extended to cover rows
6-41 if possible) I would like to be able to create a macro that check the
active cell within that range and see if a comment exitsts, if it does not,
then pop open a textbox for adding a comment.

I have a macro that works on a specified cell but not from a range. I

know this is over my head but this is how we learn, is it not? Any help will
always be much appreciated.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding Comment to cell

Wow...This is a lot to swallow for someone with my limited skills, but I shall prevail. The information is very helpful and with some tinkering I will get the result I am looking for

Thanks for the reply and the help. I will post my result when I am done so that others can learn

Thanks again.
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
adding a hyper link to a cell comment Christopher Buxton Excel Discussion (Misc queries) 6 June 25th 07 07:20 PM
Adding a comment to a cell mancitmis New Users to Excel 2 November 3rd 05 08:52 AM
adding comment to cell mancitmis Excel Discussion (Misc queries) 1 November 2nd 05 03:15 PM
Adding a comment to a formula-not a cell Floridagal Excel Discussion (Misc queries) 4 January 6th 05 12:23 AM
Adding comment programmatically Carl Rapson Excel Programming 3 February 26th 04 11:01 PM


All times are GMT +1. The time now is 05:27 AM.

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

About Us

"It's about Microsoft Excel"