![]() |
Increment outer loops
I'm having a problem with the values K and T
For K = 305 To 316 For t = 319 To 330 For Each cell In Range("G11:N298") c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) For i = 0 To 13 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next After the array and the rest of the code has finished I want t increase the value of K by one and the value of T by one. No matte where I put it I get an error. What am I missing? Thank -- Message posted from http://www.ExcelForum.com |
Increment outer loops
Will this work for you?
For K = 305 To 316 For Each cell In Range("G11:N298") c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) For i = 0 To 13 If Cells(K + 14, c(i)).Value - 1 = Cells(K, c (i)) And Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next K -----Original Message----- I'm having a problem with the values K and T For K = 305 To 316 For t = 319 To 330 For Each cell In Range("G11:N298") c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) For i = 0 To 13 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next After the array and the rest of the code has finished I want to increase the value of K by one and the value of T by one. No matter where I put it I get an error. What am I missing? Thanks --- Message posted from http://www.ExcelForum.com/ . |
Increment outer loops
For K = 305 To 316
For t = 319 To 330 For Each cell In Range("G11:N298") c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) For i = 0 To 13 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And _ Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next cell Next t Next K -- Regards, Tom Ogilvy "hotherps " wrote in message ... I'm having a problem with the values K and T For K = 305 To 316 For t = 319 To 330 For Each cell In Range("G11:N298") c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) For i = 0 To 13 If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And Cells(cell.Row, c(i) + 97) = "x" Then cell.Value = Cells(9, c(i) + 97) End If Next i Next After the array and the rest of the code has finished I want to increase the value of K by one and the value of T by one. No matter where I put it I get an error. What am I missing? Thanks --- Message posted from http://www.ExcelForum.com/ |
Increment outer loops
I thought I had tried that? But I must have been missing something. You
code ran fine. I have one more question if you don't mind. I have twelve ranges to run this code through. Each time K and increment, it should move to the next range. It is in steps of 8 and i starts in column 7 and ends in column 102 Is there an easy way to incorporate this? Thanks again -- Message posted from http://www.ExcelForum.com |
Increment outer loops
That worked fine, I thought I had it that way at one point but I gues
not. One more quick question if you don't mind. I would like to run the cod through 12 ranges each time incrementinh T and K would this be difficul to incorporate? The columns would be from 7 to 102 with a step of 8 I'm not sure how to phrase it? Thanks agai -- Message posted from http://www.ExcelForum.com |
Increment outer loops
Are you referring to my code or to Tom's?
We had different approaches to your question and mine was missing a "Next cell" line of code. So, I was guessing that, if it ran fine, it was Tom's. -----Original Message----- That worked fine, I thought I had it that way at one point but I guess not. One more quick question if you don't mind. I would like to run the code through 12 ranges each time incrementinh T and K would this be difficult to incorporate? The columns would be from 7 to 102 with a step of 8 I'm not sure how to phrase it? Thanks again --- Message posted from http://www.ExcelForum.com/ . |
Increment outer loops
Yes it was Tom's Ken but thanks for your help also
--- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 06:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com