EXCEL 매크로에서 자주 사용하는 함수 등

4171 단어 EXCEL
  • 화면 새로 고침을 닫습니다
  • Application.ScreenUpdating = False 
  • 셀 내용에 따라 행/열을 조회합니다
  • columnIndex = ActiveSheet.UsedRange.Find(" ").Column
  • 알림창에서 여분의 작업표를 삭제하지 않습니다
  • Dim Wb As Workbook
    Set Wb = Workbooks.Add ' 
    Wb.Activate
    num = Sheets.Count  ' 
    For i = 2 To num
        Application.DisplayAlerts = False  ' EXCEL 
        Worksheets(1).Delete
        Application.DisplayAlerts = True  ' EXCEL 
    Next
  • 인쇄할 때의 여백 설정 및 단위 변환
  • ' hg = (240 * 2.7682) / (20 + 3); 6:34:10:10:10, 70
    'A4 : 210mm, 297mm, 20mm, 170mm; 257mm
    ' : 1 =2.7682  1 =27.682  1 =0.3612 
    ' : 1 =0.4374  1 =4.374   1 =2.2862 
       With ActiveSheet.PageSetup
            .LeftMargin = Application.CentimetersToPoints(2) ' 
            .RightMargin = Application.CentimetersToPoints(2) ' 
            .TopMargin = Application.CentimetersToPoints(2) ' 
            .BottomMargin = Application.CentimetersToPoints(2) ' 
            .HeaderMargin = Application.CentimetersToPoints(1) ' 
            .FooterMargin = Application.CentimetersToPoints(1) ' 
    
                .CenterHorizontally = True 'False ' 
             '.CenterVertically = False' 
        End With
  • 셀 크기에 맞게 글꼴을 축소합니다
  • Columns(2).Select
    With Selection.WrapText = True
            .ShrinkToFit = False
    End With
  • 셀 테두리 선
  • Range(Cells(xinbiao + 2, 1), Cells(xinbiao + 22, 5)).Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone' 
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone ' 
    Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous ' 
    Selection.Borders(xlEdgeTop).LineStyle = xlContinuous ' 
    Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous ' 
    Selection.Borders(xlEdgeRight).LineStyle = xlContinuous ' 
    Selection.Borders(xlInsideVertical).LineStyle = xlContinuous ' 
    Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous ' 

    좋은 웹페이지 즐겨찾기