Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Comment error (Excel 2000)

    Hi all,

    I am trying to load the comment text of a cell into a textbox within a userform, it works great except when the comment is empty, or there is no comment. I know the comment is empty, what I need to know is how do I set this so that I don't get an error, do I not understand something here?

    Thanks,
    Darryl.

    Private Sub Userform_Initalize
    dim r Comment as range
    Set Rcomment=Worksheets("PRE=PRESS").Range("A20").comm ent.text
    If Rcomment is nothing then
    resume
    end if

    end sub

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comment error (Excel 2000)

    Try this:

    Private Sub Userform_Initalize()
    Dim oComment As Comment
    Dim strComment As String
    Set oComment = Nothing
    strComment = ""
    On Error Resume Next
    Set oComment = Worksheets("PRE=PRESS").Range("A20").Comment
    On Error GoTo 0
    If Not oComment Is Nothing Then
    strComment = oComment.Text
    End If
    End Sub
    Legare Coleman

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Comment error (Excel 2000)

    Thank you thank you.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2004
    Location
    Birmingham, West Midlands, United Kingdom
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comment error (Excel 2000)

    Or populate the comment as not 'empty' but with eg a space character?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •