Results 1 to 20 of 31

Thread: Show a Formula in Another Cell

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #26
    VBAX Regular
    Joined
    Jun 2004
    Location
    Denmark
    Posts
    58
    Location
    Well, my code actually looks a lot like Zack's code, but I'll post it anyway.
    For non-us users it's pracical to have the comment in their language.
    This code will change all comments in selection (if any)
    I think the only difference is the use of FormulaLocal and AutoSize.


    Sub show_formula_in_comment()
    Dim rCell As Range, OldText As String
    Application.ScreenUpdating = False
    On Error Resume Next
    For Each rCell In Selection.SpecialCells(xlCellTypeFormulas, 23)
        With rCell
            .AddComment
            With .Comment
                .Text Text:=CStr(rCell.FormulaLocal)
                .Shape.TextFrame.AutoSize = True
                .Visible = True
            End With
        End With
    Next
    Application.ScreenUpdating = True
    End Sub
     
    'Sub to remove the comments 
    Sub RemoveComments()
        Selection.ClearComments
    End Sub
    Tommy Bak
    Last edited by tommy bak; 06-23-2004 at 05:36 AM. Reason: FormulaLocal

Posting Permissions

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