Duqe's Warehouse

Visual Basic for Application의 기초 본문

정보기술

Visual Basic for Application의 기초

duqe 2024. 9. 18. 19:49

Excel Object Model

  • Application
    • Workbook
      • Worksheet
        • Range

Data Type

  • Text: String
  • Date: Date
  • Number
    • Integer
      • Byte
      • Integer
      • Long
    • Float
      • Single
      • Double
    • Currency: Currency
  • Logic: Boolean

Function

If

If Condition then
  Command
  Elseif Condition then | Else
  Command
End If

Select Case

Select Case Variable
  Case Condition1
  Command1
  Case Condition2
  Command2
  Case Condition3
  Command3
End Select

Switch

Switch(Condition1, Value1, Condition2, Value2, ...)

For

For Variable = Starting-value to End-Value setp Incremental-value
  Command
Next Variable

Do ~ Loop

Do While(Until) Condition
  Command
Loop

Property

Font

  • Name
  • Size
  • Bold
  • Italic
  • Underline
  • ThemeColor
  • TintAndShade

Interior

  • ThemeColor
  • TintAndShade

Borders

  • xlEdgeTop
  • xlEdgeBottom
  • xlEdgeLeft
  • xlEdgeRight
  • xldiagonalDown: Diagonal from TopLeft to BottomRight
  • xldiagonalUp: Diagonal from TopRight to BottomLeft
  • xlInsiderHorizontal: Inside Horizontal Border
  • xlInsiderVertical: Inside Vertical Border

LineStyle

  • xlContinuous: 실선
  • xlDash
  • xlDashDot
  • xlDashDotDot
  • xlDot
  • xlDouble
  • xlLineStyleNone
  • xlSlantDashDot: 기울어진 파선

Weight

  • xlThick
  • xlMedium
  • xlThin
  • xlHairline

Auto Fill Method

  • Structure
    • range().AutoFill Destination, Type
  • Type Constant
    • xlFillDefault: Auto
    • xlFillCopy
    • xlFillSeries
    • xlFillFormats: Only Form
    • xlFillValues: Without Form
    • xlFillDays
    • xlFillWeekdays
    • xlFillMonths
    • xlFillYears
    • xlGrowthTrend: 급수 추세 반영하기
    • xlLinearTrend: 선형 추세 반영하

Auto Fit Method

  • ColumnWidth: range().CurrentRegion.EntireColumn.Autofit
  • RowHeight: range().CurrentRegion.EntireRow.Autofit