Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
adding a hyper link to a cell comment | Excel Discussion (Misc queries) | |||
Adding a comment to a cell | New Users to Excel | |||
adding comment to cell | Excel Discussion (Misc queries) | |||
Adding a comment to a formula-not a cell | Excel Discussion (Misc queries) | |||
Adding comment programmatically | Excel Programming |