나는 이것에 대한 답변을 철저히 조사했으면 좋겠다. 시작하는 행의 사용자 입력을 기반으로 한 워크 시트의 데이터를 다른 워크 시트로 복사하려고합니다. 예를 들어, "9"를 입력하면 해당 열을 나타내는 문자를 추가하고 다른 셀까지 데이터를 복사하기 시작합니다. Excel VBA 한 시트의 데이터를 다른 시트의 사용자 입력에서 다른 시트로 복사
Sub Transfer()
Dim shSource As Worksheet
Dim cellValue As Range
Dim formatedCellBegin As Range
Dim formatedCellEnd As Range
Set shSource = ThisWorkbook.Sheets("Sheet1") 'Get info from user input sheet
Set cellValue = shSource.Cells(4, "H") 'User input taken from "H4" on sheet1 received in regards to what row to start transfer
Set formatedCellBegin = "J" & cellValue 'Add J to the that row to get the cell to start at
Set formatedCellEnd = "K" & cellValue 'End at cell K - (whatever they pick)
'Sheet 12 is the sheet with all the invoice info
'Sheet 11 is the sheet to put all the info
Sheets("Sheet12").Range("formatedCellBegin:formatedCellEnd").Copy Destination:=Sheets("Sheet11").Range("B20")
End Sub
내가 그것을 가지고
난 당신이 마지막 줄은'("Sheet12") 시트가 될 것을 원한다고 생각 범위 (formatedCellBegin, FormatedCellEnd) .Copy ...', formatedCellBegin'가입일 :
아래의 수정 된 코드를 사용해보십시오.. 주소'는'J12'와 같이 해결되어야한다. 'F8'을 사용하여 매크로를 단계별로 실행하면,이 두 범위를 설정할 때 직접 실행 창 (Ctrl + G를 눌러)에'? formatedCellBegin.address'를 입력하여 제대로 설정되었는지 확인하십시오. – BruceWayne@ 케빈 스미스는 아래의 내 대답에 코드와 설명을 참조하십시오. –