![]() |
almost works
When I run this code it finds the cells with the value "IND", it the
inserts "Brk" or "Lun" where required. Each row is 96 cells of which are populated 8 cells at a time. Afte the row has had 8 cells filled it drops down to the next row that ha INDS, but at that point the "Brk" and "Lun" are 8 cells ahead of wher they should be. I can't seem to figure out how to correct this. Thanks Dim cell As Range, cell1 As Range Dim bLunchDue As Boolean, bHadLunch As Boolean Dim l As Integer Dim k As Integer For Each cell In Range("G11:G298") bLunchDue = False bHadLunch = False l = 8 ' now walk across the row or reference cells in the row. For Each cell1 In cell.Resize(1, 96 - 7) If Application.CountIf(cell1.Resize(1, l), "IND") = l Then If l = 8 Then cell1.Offset(0, 8).Value = "Brk" bLunchDue = True If bLunchDue Then cell1.Offset(0, 17).Value = "Lun" cell1.Offset(0, 18).Value = "Lun" cell1.Offset(0, 24).Value = "Brk" bLunchDue = False bHadLunch = True End If l = l + 8 bLunchDue = True If bLunchDue Then If l = 50 Then l = 0 End If End If End If Next Nex -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 06:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com