수색…


비고

설명 블록

한 번에 여러 줄을 주석 처리하거나 주석 처리를 제거해야하는 경우 IDE의 Edit Toolbar 버튼을 사용할 수 있습니다.

설명 블록 - 선택한 모든 선의 시작 부분에 단일 아포스트로피를 추가합니다.

댓글 블록

Uncomment Block - 선택한 모든 라인의 시작 부분에서 첫 번째 아포스트로피를 제거합니다.

블록 주석 해제

여러 줄 주석 많은 다른 언어가 여러 줄 주석을 지원하지만 VBA는 한 줄 주석 만 허용합니다.

아포스트로피 설명

주석은 아포스트로피 ( ' )로 표시되고 코드가 실행될 때 무시됩니다. 주석은 자신을 포함하여 향후 독자에게 코드를 설명하는 데 도움이됩니다.

주석으로 시작하는 모든 행은 무시되므로 디버그 또는 리팩터링하는 동안 코드 실행을 방지하는 데 사용할 수도 있습니다. 아포스트로피를 배치 ' 코드 전에 것은 주석으로 바뀝니다. (이것을 주석으로 처리한다고 합니다.)

Sub InlineDocumentation()
  'Comments start with an "'"

  'They can be place before a line of code, which prevents the line from executing
  'Debug.Print "Hello World"

  'They can also be placed after a statement
  'The statement still executes, until the compiler arrives at the comment
  Debug.Print "Hello World"  'Prints a welcome message

'Comments can have 0 indention....
     '... or as much as needed

  '''' Comments can contain multiple apostrophes ''''

  'Comments can span lines (using line continuations) _
    but this can make for hard to read code

  'If you need to have mult-line comments, it is often easier to 
  'use an apostrophe on each line

  'The continued statement syntax (:) is treated as part of the comment, so 
  'it is not possible to place an executable statement after a comment
  'This won't run : Debug.Print "Hello World"
End Sub

'Comments can appear inside or outside a procedure

REM 설명

Sub RemComments()
  Rem Comments start with "Rem" (VBA will change any alternate casing to "Rem")
  Rem is an abbreviation of Remark, and similar to DOS syntax
  Rem Is a legacy approach to adding comments, and apostrophes should be preferred

  Rem Comments CANNOT appear after a statement, use the apostrophe syntax instead
  Rem Unless they are preceded by the instruction separator token
  Debug.Print "Hello World": Rem prints a welcome message
  Debug.Print "Hello World" 'Prints a welcome message

  'Rem cannot be immediately followed by the following characters "!,@,#,$,%,&"
  'Whereas the apostrophe syntax can be followed by any printable character.

End Sub

Rem Comments can appear inside or outside a procedure


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow