try this instead of your Sub put_w():
Sub put_w2()
Dim ws As Worksheet
Dim i As Long
Dim rTFind As Range, rBFind, rFirst, mylookin As Range

Set ws = ThisWorkbook.Worksheets("pp")
rTitle = ws.Cells.find("Balance", ws.[A1], xlValues, xlPart).Row
'Spot bottom row of data
LR = ws.Cells(ws.Rows.count, "A").End(xlUp).Row
'# Start search
' # Search for the "period" in column A to spot the top of the data range

Set rTFind = ws.Range("A:A").find(".", ws.[A1], xlValues, xlWhole)
If Not rTFind Is Nothing Then
  Set rFirst = rTFind
  Do
    'sname = Format(Day(Int(rTFind.Offset(-1))) + 1, "DD")

    'ws.Rows(rTitle).Copy Sheets(sname).Cells(rTitle, "A")
    With ws
      'then count the occurence in that row range which have  "w"
      '' how i can incorporate this function to count in my code ?
      Set mylookin = rTFind.CurrentRegion.Columns(12)
      Set mylookin = mylookin.Offset(1).Resize(mylookin.Rows.count - 1)
      Var = count("w", mylookin)
      'if it is less then 6 time then change the value in column L to make
      If Var < 6 Then
        For i1 = mylookin.Rows.count To 1 Step -1
          'mylookin.Cells(i1).Select  'pd
          If Var < 6 And mylookin.Cells(i1).Value <> "w" Then
            mylookin.Cells(i1).Select  'pd
            myResponse = MsgBox("u want to change value of L" & Selection.Row & "?" & vbLf & "Cancel moves on to the next group", vbYesNoCancel, "Order Complete")
            Select Case myResponse
              Case vbCancel
                Exit For
              Case vbYes
                mylookin.Cells(i1).Value = "w"
                Var = Var + 1
            End Select
          End If
        Next i1
      End If
    End With

    Set rTFind = ws.Range("A:A").FindNext(rTFind)
    If rTFind.Address = rFirst.Address Then Exit Do
  Loop
  ' Stop
End If
Set rTFind = Nothing
Set rBFind = Nothing
Set rFirst = Nothing
End Sub
Also this needs a tweak to avoid confusion:
Function count(find As String, lookin As Range) As Long
    Dim cll As Range
    For Each cll In lookin.Cells
        If (cll.Value = find) Then count = count + 1    '//case sens
    Next
End Function