|
こういうことですか。
Dim ToCell As Range
Const shName1 As String = "Sheet1"
Const shName2 As String = "Sheet2"
Const shName3 As String = "Sheet3"
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Sh Is Sheets(shName2) Then
If ToCell Is Nothing Then
MsgBox "先に転記先のセルをクリックしてから、このシートでダブルクリックしてください"
Exit Sub
End If
ToCell.Value = Target.Value
Application.Goto ToCell
Set ToCell = Nothing
ElseIf Sh Is Sheets(shName3) Then
If ToCell Is Nothing Then
MsgBox "先に転記先のセルをクリックしてから、このシートでダブルクリックしてください"
Exit Sub
End If
ToCell.Value = Target.Value
Application.Goto ToCell
Set ToCell = Nothing
ElseIf Sh Is Sheets(shName1) Then
Set ToCell = Target
Select Case Target.Address
Case "$A$1"
Sheets(shName2).Activate
Case "$B$1"
Sheets(shName3).Activate
End Select
End If
End Sub
|
|