Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help on how it works.... deepak Excel Discussion (Misc queries) 1 January 28th 09 08:01 AM
This almost works, but... Mr. Smiley Excel Discussion (Misc queries) 2 September 15th 05 07:24 PM
How do I convert works file to excel without works software? CatMB Excel Discussion (Misc queries) 1 June 21st 05 04:12 PM
One works - One does not? hotherps[_131_] Excel Programming 2 August 27th 04 02:37 PM
MS Works and VB Tim Childs Excel Programming 3 September 28th 03 08:56 PM


All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"