엑셀

담당별분리

아스C# 2018. 11. 23. 15:00
반응형


Sub 담당별분리()

  stname = ActiveSheet.Name

   

  olines = Last_Lines_입출고("D")

  If olines <= 0 Then Exit Sub


  Dim arrGrd()

  arrGrd = Range("A301").Resize(olines, totalCols)

      

  ReDim arrGrdRt(1 To olines, 1 To totalCols)

  Dim CurLines As Integer

  CurLines = 0

  

  Dim ItemsCount As Integer

  Dim Items() As String

  

  Call Area_Init

  

  For i = 1 To AreaCount

    For j = 1 To olines

      For k = 1 To AreaUpsoCnt(AreaCode(i))

        stuname = Areaupso(AreaCode(i), k)

        If stuname = arrGrd(j, 5) Then

          CurLines = CurLines + 1

          For l = 1 To totalCols

            arrGrdRt(CurLines, l) = arrGrd(j, l)

          Next

        End If

      Next

    Next

    

    If CurLines = 0 Then

       GoTo label_2

    End If

    

    시트_선택_없으면_만들기_폼에서 ("&" & AreaName(i))

    

    [d1] = AreaName(i)

    

    Range("A6").Offset(0, 0).Resize(CurLines, 19) = arrGrdRt

    Call Line_Grid_Draw("A5:S" & (CurLines + 5))

    '금액부분 감추기

    If bMaechulDisplay = True Then

'      Rows("1:4").AutoFit

      Rows("1:4").RowHeight = 16.5

'      Call func_Print_Seting("A1:S" & (CurLines + 5), [d1], 0)

    Else

      Rows("1:4").RowHeight = 0

'      Call func_Print_Seting("A5:S" & (CurLines + 5), [d1], 0)

    End If

    If bDangaDisplay = True Then

      Columns("J:O").AutoFit

    Else

      Columns("J:O").ColumnWidth = 0

    End If


  Next

  

Sheets(stname).Select

End Sub


반응형