View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Is there a way to extract numbers from comments for use in a formu

Let's say we are talking about a single cell that contains a comment and the
comment contains a single number and nothing else. Select the cell and run:

Sub get_comment_number()
Dim s As String, n As Long
With Selection
.Comment.Visible = True
s = .Comment.Text
n = s * 1#
.Value = n
End With
End Sub

The macro will set the value of the cell equal to the number in the comment.


Remember:
1.the original contents of the cell will be over-written
2.will work only on a single cell
3.the comment must be a single number
--
Gary's Student


"cadscout" wrote:

I have comments that have numbers in them that I would like to be able to
extract from the comments and use a mathematical formula (simple
multiplication) to find the product of the numbers.

Thanks for any help that you can provide!