0
Sub Sample()

Dim wsI As Worksheet, wsO As Worksheet, ws2 As Worksheet
Dim LastRow As Long, i As Long, j As Long

Set wsI = Sheets("EC6")
Set wsO = Sheets("2")

 LastRow = wsI.Range("A" & Rows.Count).End(xlUp).Row

j = 1

With wsI
    For i = 1 To LastRow
        wsI.Rows(i).Copy wsO.Rows(j)

        j = j + 1
    Next i
End With
End Sub

値のみを wsI から wsO にコピーするにはどうすればよいですか?

4

1 に答える 1

0

コピー先のワークシートが既に存在する場合 (つまり、1 から 31 までの名前の 31 個のワークシートがある場合):

Dim wsI As Worksheet, wsO As Worksheet, ws2 As Worksheet
Dim LastRow As Long, i As Long, j As Long

Set wsI = Sheets("EC6")

Set wsO = Sheets(wsI.Cells(49, 1).Value)

LastRow = wsI.Range("A" & Rows.Count).End(xlUp).Row

j = 1

With wsI
    For i = 1 To LastRow
        wsI.Rows(i).Copy wsO.Rows(j)

        j = j + 1
    Next i
End With
于 2012-10-23T13:57:56.000 に答える