|
▼Blue さん:
ご指摘ありがとうございました。
Longにしたらできそうです。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Pnm As String
Dim Cnm As String
Dim ws1 As Worksheet
Dim i As Long
If Not Application.Intersect(Range("B5:B107"), Target) Is Nothing Then
With Target
Pnm = .Offset(, 1).Value
Cnm = .Offset(, 2).Value
End With
Set ws1 = Worksheets("Sheet2")
For i = 5 To ws1.Range("B5").End(xlDown).Row
If IsEmpty(ws1.Cells(i, 2).Value) Then
ws1.Cells(i, 2).Value = Pnm
ws1.Cells(i, 3).Value = Cnm
Exit For
End If
Next i
Cancel = True
End If
End Sub
|
|