Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim no As Long
Dim I As Long
Dim rng As Range
Dim cl As Range
If Not Intersect(Target, Range("K6:AO106")) Is Nothing Then
Application.EnableEvents = False
Set rng = Target.Resize(, 32 - Cells(6, Target.Column).Value)
no = Range("G5").Value
For Each cl In rng
If Cells(8, cl.Column).Value <> "*" And Cells(8, cl.Column).Value <> "X" And I < no Then
I = I + 1
cl = I
End If
Next cl
End If
Application.EnableEvents = True
Range("AQ8") = no - I
End Sub
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim no As Long
Dim I As Long
Dim rng As Range
Dim cl As Range
If Not Intersect(Target, Range("K9:AO9")) Is Nothing Then
Application.EnableEvents = False
Set rng = Target.Resize(, 32 - Day(Cells(6, Target.Column).Value))
no = Range("G5").Value
For Each cl In rng
If Cells(8, cl.Column).Value <> "*" And Cells(8, cl.Column).Value <> "X" And I < no Then
I = I + 1
cl = I
End If
Next cl
End If
Application.EnableEvents = True
Range("AQ8") = no - I
End Sub