javascript

  • LV 3 playboy
  • 비추천 0
  • 추천 0
  • 조회 1579
  • 2017.09.27 22:14
  • 문서주소 - http://ec2-52-194-161-77.ap-northeast-1.compute.amazonaws.com/bbs/board.php?bo_table=bangzhu&wr_id=183916
Private Const sheetTblName As String = "data"
Private Const SetCellsName As String = "$E$5"
Private Const ColumnsName As String = "$B$2"
Private Const ToCell As String = "$A$1"

Sub select_match()
    Dim iRow As Integer
    Dim iRow2 As Integer
    Dim iColumn As Integer
    Dim iColumn2 As Integer
    Dim iRowCount As Integer
    iRowCount = 0
    With ActiveSheet
        For iRow = .UsedRange.Row To .UsedRange.Row + .UsedRange.Rows.Count
            iColumn = Range(SetCellsName).Column
            iColumn2 = Range(ColumnsName).Column
            shearch_str = Trim(.Cells(iRow, iColumn).Value)
            If shearch_str <> "" Then
                With Sheets(sheetTblName)
                    For iRow2 = .UsedRange.Row To .UsedRange.Row + .UsedRange.Rows.Count
                        ind_str = Trim(.Cells(iRow2, iColumn2).Value)
                        If shearch_str = ind_str Then
                             tt = cpyRange(iRowCount, iRow2, .UsedRange.Column, .UsedRange.Column + .UsedRange.Columns.Count)
                             iRowCount = iRowCount + 1
                            Exit For
                        End If
                    Next
                End With
            End If
        Next
    End With
End Sub
Function cpyRange(toRow As Integer, Row As Integer, startColumn As Integer, endColumn As Integer) As String
    Dim iColumn As Integer
    Dim iColumnCount As Integer
    iColumnCount = 0
    For iColumn = startColumn To endColumn
        ThisWorkbook.Sheets("tmp").Cells(Range(ToCell).Row + toRow, Range(ToCell).Column + iRowCount) = Sheets(sheetTblName).Cells(Row, iColumn)
        iRowCount = iRowCount + 1
    Next
End Function

추천 0 비추천 0

LV 3playboy
  • MP : 5,576
  • SP : 0
XP (57%)
Lv 3
등록된 서명이 없습니다.
현재 게시판에서 작성한 게시물 더보기
Print