When I double click in column G of my worksheet 'Week'
I get an error 'Object Required' om the line 'If Target.Column <> 9 Then'
When the error appears, the worksheet 'Planner' is activated for reasons unknown.
Can you please correct the error and make the code more efficient,
In the module:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim response As VbMsgBoxResult
    Dim originalSheet As Worksheet
    Set originalSheet = ThisWorkbook.Sheets("Week")
    ThisWorkbook.Sheets("Week").Unprotect Password:="edit"
    Application.EnableEvents = False
    Application.ScreenUpdating = False

    ' Check if double-click occurred in column A
    If Target.Column <> 1 Then
    GoTo ColumnG
    End If
    If Not Intersect(Target, Me.Range("A2:A" & Me.Rows.count)) Is Nothing Then
        ' Prevent entering edit mode on double-click
        Cancel = True

        ' Ask user if they want to duplicate the task
        response = MsgBox("Do you want to duplicate the task?", vbQuestion + vbYesNo)

        If response = vbYes Then
        Dim originalRow As Range
        Dim cellA As Range
        Dim wsArchive As Worksheet
        Dim nextRow As Long
        Set wsArchive = ThisWorkbook.Sheets("Archive")
        Set originalRow = Range(Target, Target.Offset(, 10))
        
            
            wsArchive.Unprotect Password:="edit"
            ' Find the next available row in the Archive sheet
            nextRow = wsArchive.Cells(wsArchive.Rows.count, 1).End(xlUp).row + 1

            ' Copy the original row to the next available row in the Archive sheet
            originalRow.Copy
            wsArchive.Range("A" & nextRow).PasteSpecial xlPasteValues
            wsArchive.Cells(nextRow, 13).Value = "Week"
            wsArchive.Protect Password:="edit"

            ' Insert a new row below the double-clicked cell
            Target.Offset(1).EntireRow.Insert Shift:=xlDown
            
            ' Archive the original values
            originalRow.Copy
            wsArchive.Range("A" & nextRow + 1).PasteSpecial xlPasteValues
            wsArchive.Cells(nextRow + 1, 13).Value = "Week"
            
            ' Ask user if they want to replace Execution Notes with Outcomes
            response = MsgBox("Do you also wish to replace your Execution Notes with Outcomes?", vbQuestion + vbYesNo)

            If response = vbYes Then
                ' Replace Execution Notes with Outcomes
                Target.Offset(0, 8).Value = Target.Offset(0, 10).Value

            ' Make additional modifications to the new row
            Target.Offset(1, 8).Value = "ARCHIVED. Enter 'Cancelled' to delete"
            Target.Offset(0, 10).Value = "ADJUST. Execution & Status"

            ' Display the message
            MsgBox "Duplicate Row of Task has been created" & vbCrLf & _
                   "In original row, enter complete to close the row" & vbCrLf & _
                   "to archive progress of the task", vbInformation, "TASK PROGRESS"

            ' Switch back to the original sheet
            originalSheet.Activate
            End If
        End If
    End If
      
ColumnG:
' Check if the double-click is in column G (2 to n)
If Target.Column <> 7 Then
GoTo ColumnI
End If
    If Not Intersect(Target, Me.Range("G2:G" & Me.Rows.count)) Is Nothing Then
        If IsDate(Target.Value) Then
            ' Call the second module and pass the target address
            Call WriteToNotepad(Target.Address)
            Cancel = True ' Prevent the default double-click action (edit mode)
        End If
    End If

ColumnI:
' Check if double-click occurred in column I
If Target.Column <> 9 Then
GoTo ColumnEnd
End If
If Not Intersect(Target, Me.Range("I2:I" & Me.Rows.count)) Is Nothing Then
    Dim lastRow As Long
    Dim copyRange As Range
    Dim pasteRow As Long
    Dim cellI As Range
    Dim archiveSheet As Worksheet
    Dim diff As Integer
    Dim answer As VbMsgBoxResult

    Set archiveSheet = ThisWorkbook.Sheets("Archive")
    ' Prevent entering edit mode on double-click
    Cancel = True

    ' Ask user if they want to duplicate the task
    answer = MsgBox("Do you want to archive Current Status of Task?", vbQuestion + vbYesNo)

    If answer = vbNo Then
    GoTo ColumnEnd
    End If

    For Each cellI In Target
        If answer = vbYes Then
            ' Determine the last row in the Archive sheet
            lastRow = archiveSheet.Cells(Rows.count, 1).End(xlUp).row + 1

            ' Unprotect sheets before pasting
            Me.Unprotect Password:="edit"
            archiveSheet.Unprotect Password:="edit"

            ' Copy the entire row (A:K) to the Archive sheet
            If Not Target.Comment Is Nothing Then
                Target.Comment.Delete

            Me.Range("A" & cellI.row & ":K" & cellI.row).Copy
            archiveSheet.Range("A" & lastRow).PasteSpecial xlPasteValues

            Target.AddComment "Task Status Archived " & Date

            ' Protect sheets after pasting
            archiveSheet.Protect Password:="edit"
            Me.Protect Password:="edit"

            ' Display the message
            MsgBox "Current Status of Task Archived" & vbCrLf & _
                   "You can now amend the task with New Status" & vbCrLf & _
                   "in Execution / Status / Outcome", vbInformation, "TASK PROGRESS"
                End If
            End If
    Next cellI
    End If

ColumnEnd:
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    ThisWorkbook.Sheets("Week").Protect Password:="edit"
    
End Sub