|
Dim SourceSheet, 貼り付け先DestSheet As Worksheet
Dim c As Range
Dim Text As String
Dim i As Long
Text = InputBox("もしもし")
Set SourceSheet = Sheet1 ' 探すシートを指定
Set 貼り付け先DestSheet = Sheet2 ' 貼り付け先のシート
' ↓ここの列(A)で検索
Set c = SourceSheet.Range("A2:A65536").Cells. _
Find(What:=Text, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False)
If Not c Is Nothing Then
For i = 1 To 65536
If 貼り付け先DestSheet.Cells(i, 1) = "" Then
SourceSheet.Range(SourceSheet.Cells(c.Row, 1).Address + ":" + _
SourceSheet.Cells(c.Row, 256).Address).Copy
SourceSheet.Paste Destination:=貼り付け先DestSheet.Range("A" & i)
Exit For
ElseIf i = 65536 Then
MsgBox "もういっぱいで書き込めないや(-.-) " + CStr(i)
End If
Next
Else
MsgBox "そんなのないよん"
End If
|
|