Why when I put the following code does it ask me to create a sub name? And can someone help me so that it doesnt? I just want to paste then into module, click play, and it works without making me open another sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("X:AI")) Is Nothing Then
        Dim ws As Worksheet
Dim x As Variant, j As Variant
Dim lr As Long, i As Long, ii As Long, c As Long, h As String
Set ws = ActiveSheet
ws.Columns("AJ:AJ").Clear
lr = ws.Cells.Find("*", , xlValues, xlWhole, xlByRows, xlPrevious, False).Row
x = ws.Range("X2:AI" & lr)
ReDim j(1 To UBound(x, 1), 1 To 1)
For i = LBound(x, 1) To UBound(x, 1)
  h = ""
  For ii = LBound(x, 2) To UBound(x, 2)
    If x(i, ii) <> "" Then
      h = h & x(i, ii) & " "
    End If
  Next ii
  If Right(h, 1) = " " Then h = Left(h, Len(h) - 1)
  j(i, 1) = h
Next i
ws.Range("AJ2").Resize(UBound(j, 1)) = j
Erase x: Erase j
    End If
End Sub