이 기사에서는 불완전한 데이터를 새 시트에 복사하는 매크로를 만듭니다.

이 기사의 원시 데이터는 일부 불완전한 레코드를 포함하는 급여 데이터로 구성됩니다.

ArrowMain

급여 세부 정보가 누락 된 직원의 기록을 복사하려고합니다. 버튼을 클릭하면 불완전한 레코드가 “BlankRecords”시트로 이동합니다.

ArrowOutput

논리 설명

이 기사에서는 누락 된 레코드를“BlankRecords”시트에 복사하는“CopyEmptys”매크로를 만들었습니다. Salary 열에서 빈 레코드를 확인합니다. 빈 레코드가 발견되면 해당 레코드를 “BlankRecords”시트에 복사합니다.

코드 설명

intRowL = Cells (Rows.Count, 1) .End (xlUp) .Row 위 코드는 마지막 셀의 행 번호를 가져 오는 데 사용됩니다.

IsEmpty (셀 (intRow, 4))

위의 코드는 언급 된 급여가 비어 있는지 확인하는 데 사용됩니다.

아래 코드를 따르세요

Range (.Cells (intRowT, 1), .Cells (intRowT, 3)). Value = Range (Cells (intRow, 1), Cells (intRow, 3)). Value 위 코드는 누락 된 복사본을 갖는 데 사용됩니다. 메인 시트에서 “BlankRecord”시트로 녹음합니다.
Option Explicit

Sub CopyEmptys()

'Declaring variables

Dim intRow As Integer, intRowL As Integer, intRowT As Integer

'Getting row number of last cell

intRowL = Cells(Rows.Count, 1).End(xlUp).Row

'Looping from 10th row to last cell

For intRow = 10 To intRowL



'Checking the fourth column whether it is empty

If IsEmpty(Cells(intRow, 4)) Then

With Worksheets(2)

'Getting row number of row next to last row

intRowT = .Cells(.Rows.Count, 1).End(xlUp).Row + 1



'Inserting data to "BlankRecords" sheet

.Range(.Cells(intRowT, 1), .Cells(intRowT, 3)).Value = _

Range(Cells(intRow, 1), Cells(intRow, 3)).Value

End With

End If

Next intRow

End Sub

이 블로그가 마음에 들면 Facebook 및 Facebook에서 친구들과 공유하십시오.

여러분의 의견을 듣고 싶습니다. 작업을 개선하고 더 나은 서비스를 제공 할 수있는 방법을 알려주십시오. [email protected]로 문의 해주세요