Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
I'm trying to finish this up but I'm having a problem with the oute
loops. For K = 305 To 316 ' For t = 319 To 330 ' For Each cell In Range("G11:n298") Step 8 ' c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) For i = 0 To 11 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 An _ Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next cell Next K ' Next t ' What I'm trying to do is after the array completes I want to incremen K by 1 and t by 1 and then step over to the next 8 columns("O11:V298" and run the code again. I have comments on the end of the lines that are not working. Thank -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
foo = -1
For K = 305 To 316 t = K + 14 foo = foo + 8 For Each cell In Range(.Cells(11, foo), .Cells(298, foo + 7)) Step 8 blahblahblah Next K - piku -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
Thanks
I hate to ask but, I'm getting an error. The line with the "For Each statment is colored red. I think I pasted it correctly? foo = -1 For K = 305 To 316 t = K + 14 foo = foo + 8 For Each cell In Range(.Cells(11, foo), (.Cells(298, foo + 7)) Step 8 c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) For i = 0 To 11 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 An _ Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next cell Next -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
Hey,
I only looked at the lines that were broken before, but now that I' looking a little more closely, I think you're going about this the lon way. Please describe to me what it is you're doing in greater detail. Thanks. - piku -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
Try
For Each cell In Range(.Cells(11, foo), .Cells(298, foo + 7)) Step 8 -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "hotherps " wrote in message ... Thanks I hate to ask but, I'm getting an error. The line with the "For Each" statment is colored red. I think I pasted it correctly? foo = -1 For K = 305 To 316 t = K + 14 foo = foo + 8 For Each cell In Range(.Cells(11, foo), (.Cells(298, foo + 7)) Step 8 c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) For i = 0 To 11 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 And _ Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next cell Next K --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
I'm sure I'm going about it wrong, it has been a real struggle. Thanks
It's kind of complicated, maybe you could view the attachment Attachment filename: scheduledemo.zip Download attachment: http://www.excelforum.com/attachment.php?postid=64420 -- Message posted from http://www.ExcelForum.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
c = Array(7, 8, 9, 10, 11, ...
You keep generating this same array with each loop. I would move this to the very beginning so as to make it only once. Actually, it appears you could drop the array, maybe something along this line: For c = 7 To 18 If Cells(t, c).Value - 1 = Cells(K, c) And ...etc Just an idea. Dana DeLouis "hotherps " wrote in message ... Thanks I hate to ask but, I'm getting an error. The line with the "For Each" statment is colored red. I think I pasted it correctly? foo = -1 For K = 305 To 316 t = K + 14 foo = foo + 8 For Each cell In Range(.Cells(11, foo), (.Cells(298, foo + 7)) Step 8 c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) For i = 0 To 11 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 And _ Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next cell Next K --- Message posted from http://www.ExcelForum.com/ |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
Thanks Bob but isn't your line exactly the same as what Pikus has?
I got the same error :Expected end of statment ??? Thanks Dana, I guess that could work, but I have some time constraint at the moment. Maybe I can try it later -- Message posted from http://www.ExcelForum.com |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
Hey again. It's funny to me that this is about scheduling. I am, by
trade, a workforce management analyst. I'll be taking this home with me. I sent you my e-mail address in a private message, e-mail me and I can send you the file as soon as it's complete. - pikus --- Message posted from http://www.ExcelForum.com/ |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
No I took out an extraneous ( which looked like the error to me.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "hotherps " wrote in message ... Thanks Bob but isn't your line exactly the same as what Pikus has? I got the same error :Expected end of statment ??? Thanks Dana, I guess that could work, but I have some time constraints at the moment. Maybe I can try it later. --- Message posted from http://www.ExcelForum.com/ |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range of columns
Yes i do see the difference now Bob, but the text still goes to a red
font and I get a syntax error message. Thanks for the post --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Linest - different columns for x range | Excel Worksheet Functions | |||
Sum a range of columns ? | Excel Discussion (Misc queries) | |||
How do I get the MAX value of adjoining columns then SUM range? | Excel Worksheet Functions | |||
Set range as multiple columns | Excel Programming | |||
No of columns in range | Excel Programming |