sorry hear my change from yr original code
Sub aa_put_w()
Dim ws1 As Worksheet
Dim iw As Long, LR, Var
Dim rTFind As Range, rBFind, rFirst, mylookin As Range
Dim a As String, nm
Dim cc As Double
Set ws1 = ThisWorkbook.Worksheets("RR")
ws1.Activate
' rTitle = ws.Cells.find("Balance", ws.[A1], xlValues, xlPart).Row
'Spot bottom row of data
' LR = ws1.Cells(ws1.Rows.count, "A").End(xlUp).Row
'# Start search
' # Search for the "period" in column A to spot the top of the data range
On Error Resume Next
nm = Application.InputBox("Name to be inserted in C ?", Title:="Name Input", Default:="P B", Type:=2) 'type 2 is text
If nm = "" Then GoTo ExitHandler
'On Error Resume Next
cc = Application.InputBox("Name to be inserted in C ?", Default:=41.29, Type:=1) 'type 1 is num
If cc = 0 Then GoTo ExitHandler
Set rTFind = ws1.Range("A:A").find(".", ws1.[A1], xlValues, xlWhole)
If Not rTFind Is Nothing Then
Set rFirst = rTFind
Do
'With ws1
'then count the occurence in that row range which have "w"
Set mylookin = rTFind.CurrentRegion.Columns(12)
Set mylookin = mylookin.Offset(1).Resize(mylookin.Rows.count - 1)
Var = count("Weekly", mylookin)
'if it is less then 6 time then change the value in column L to makeup for 6 time
mylookin.Cells(iw, 2).Value = Var
If Var < 6 Then
For iw = mylookin.Rows.count To 1 Step -1
'mylookin.Cells(iw).Select
If Var < 5 And mylookin.Cells(iw).Value <> "Weekly" Then '''to make 6 count weekly
mylookin.Cells(iw, 3).Value = Var 'Selection.Row 'mylookin.Cells(i1).Value '.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(iw).Value = "Weekly"
mylookin.Cells(iw, -8).Value = nm
mylookin.Cells(iw, -6).Value = cc
mylookin.Cells(iw, -5).Value = cc
Var = Var + 1
' End Select
End If
Next iw
End If
'End With
Set rTFind = ws1.Range("A:A").FindNext(rTFind)
If rTFind.Address = rFirst.Address Then Exit Do
Loop
' Stop
End If
ExitHandler:
Set Var = Nothing
Set rTFind = Nothing
Set rBFind = Nothing
Set rFirst = Nothing
End Sub
'''' for weekly counts
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
when i try to run macro again for < 6 it count all weekly in column L i try to print on sh in "M3" i also added the new work book where code not work