2012-09-24 2 views
2

조건부에서 셀로 메모를 반환하는 방법.Excel : 조건부에서 셀로 메모를 반환하는 방법

예 :

=if(a1=0;insert comment on cell) 

삽입 주석과 쇼 주석이에 대한 자신의 함수를 선언해야 할 수도 있습니다, 그래서 내가, 기본 워크 시트 함수와 어떤 방법을 찾을 수 없습니다

+1

워크 시트 기능으로는이 작업을 수행 할 수 없습니다. VBA 매크로를 사용하여 작업 할 수 있습니다. //msdn.microsoft.com/en-us/library/office/aa221696(v=office.11) .aspx –

답변

7

-이 같은 :

Public Function GetComment(rng As Range) as String 
    GetComment = rng.NoteText 
'also possible 
'GetComment = rng.Comment.Text 
End Function 

이 기능을 모듈에 저장하면 워크 시트 기능으로 액세스 할 수 있습니다.

다음에 =if(a1=0;GetComment(A1))을 사용하여 주석을 반환하십시오.

편집 : 나는 조금 오해 수 있기 때문에

- 여기에 발신자 셀에 메모를 추가하는적인 버전이있다, 주어진 코멘트에 콘텐츠를 설정하고 댓글을 볼 수 있습니다.

Public Function AddCmt(strComment As String) As String 
    Dim rngCaller As Range 
    If TypeName(Application.Caller) Like "Range" Then 
    Set rngCaller = Application.Caller 
    With rngCaller 
     If .Comment Is Nothing Then 
     .AddComment (strComment) 
     Else 
     .Comment.Text strComment 
     End If 
     .Comment.Visible = True 
    End With 
    'set caller-cell content to given comment 
    AddCmt= strComment 
    End If 
End Function 
+0

정확합니다. VBA를 통해 프로그래밍 방식으로 만 주석을 편집 할 수 있습니다 . – danielpiestrak

관련 문제