Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to go through a column of data and find which cells have "comments"
so when it hit's the cell that has a comment i just want it to let me know so when i write my code i can write something like if cell(x,y) has a comment then z = true end if so |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe...
if cells(x,y).comment is nothing then 'no comment else z = true end if dstiefe wrote: I want to go through a column of data and find which cells have "comments" so when it hit's the cell that has a comment i just want it to let me know so when i write my code i can write something like if cell(x,y) has a comment then z = true end if so -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
question...
what is the opposite of "nothing" so if you wanted to put if cells(x,y).comment is ??????? then z = true else no comment end if "Dave Peterson" wrote: Maybe... if cells(x,y).comment is nothing then 'no comment else z = true end if dstiefe wrote: I want to go through a column of data and find which cells have "comments" so when it hit's the cell that has a comment i just want it to let me know so when i write my code i can write something like if cell(x,y) has a comment then z = true end if so -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The opposite of True is Not True, so...
If Not Cells(x, y).Comment Is Nothing Then z = True Else ' No comment End If Out of curiosity, what are you doing? I ask because it almost sounds like the purpose of your code is to find and then do something with the comments in a column and not do anything else. If that is the case, you can iterate the Comments collection and work directly with the ones you want. For example, this macro... Sub FindComments() Dim C As Comment If ActiveSheet.Comments.Count 0 Then For Each C In ActiveSheet.Comments If C.Parent.Column = 1 Then Debug.Print C.Parent.Address(0, 0) & " has the comment: " & C.Text End If Next End If End Sub will print out the address of the cells in Column A and what the comment is that it contains. Obviously, this is a very simplistic; however, you can do whatever you need to in place of the Debug.Print statement I used in my example. Inside the inner If-Then block, C will hold a reference to a Comment object which you can use in your code. I'm not sure what you are trying to do (assuming I'm right and that you only are interested in doing something only with the comments or the cells that contain the comments), but if you give us more details, we would be happy to help. -- Rick (MVP - Excel) "dstiefe" wrote in message ... question... what is the opposite of "nothing" so if you wanted to put if cells(x,y).comment is ??????? then z = true else no comment end if "Dave Peterson" wrote: Maybe... if cells(x,y).comment is nothing then 'no comment else z = true end if dstiefe wrote: I want to go through a column of data and find which cells have "comments" so when it hit's the cell that has a comment i just want it to let me know so when i write my code i can write something like if cell(x,y) has a comment then z = true end if so -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA doesn't support Something.
You can either change "if" portion or use the Then and Else portion. I like the added ()'s: if not (cells(x,y) is nothing) then 'it has a comment else 'it has no comment end if dstiefe wrote: question... what is the opposite of "nothing" so if you wanted to put if cells(x,y).comment is ??????? then z = true else no comment end if "Dave Peterson" wrote: Maybe... if cells(x,y).comment is nothing then 'no comment else z = true end if dstiefe wrote: I want to go through a column of data and find which cells have "comments" so when it hit's the cell that has a comment i just want it to let me know so when i write my code i can write something like if cell(x,y) has a comment then z = true end if so -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel 2000 how to format the comments font all comments | Excel Discussion (Misc queries) | |||
Comments | Excel Discussion (Misc queries) | |||
comments | Excel Discussion (Misc queries) | |||
in excel useing comments how do you add clip art to comments? | New Users to Excel | |||
Comments Help | Excel Worksheet Functions |