ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Initialize variable (https://www.excelbanter.com/excel-programming/308073-initialize-variable.html)

hotherps[_128_]

Initialize variable
 
I'm using the following code:


What I;m trying to do is add one more offset statement like this

And .Cells(x, y).Offset(0, -8).Value < "IND" _

But from where the code starts I get an error because I'm using colum
G to start, which is the 7th column. I can start this code as late a
column O then there would be onough cells to look back -8.

But I can't figure out how to do it.

Thanks


With Sheet236
For x = 11 To 298
counter = 8

For n = 1 To timeStart

Next n
If .Cells(x, skilly).Value = "x" And did = False Then
For y = timeStart To timeStart + 7

If .Cells(x, y).Value = "." _
And counter < 9 _
And need 0 _
And x = 19 _
And .Cells(x, y).Value < "" _
And .Cells(x, y).Offset(-8, 0).Value < "IND" _
And .Cells(x, y).Offset(8, 0).Value < "IND" _
And .Cells(x, y).Offset(0, 8).Value < "IND" Then
_

.Cells(x, y).Offset(0, 0).Resize(1, 8).Value = "ENG"
'.Cells(x, y).Value = "ENG"
counter = counter + 1
need = need - 8
End I

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Initialize variable
 
And .Cells(x, y).Offset(0, -1 * Application.Min(y-1,8)).Value < "IND"

--
Regards,
Tom Ogilvy

"hotherps " wrote in message
...
I'm using the following code:


What I;m trying to do is add one more offset statement like this

And .Cells(x, y).Offset(0, -8).Value < "IND" _

But from where the code starts I get an error because I'm using column
G to start, which is the 7th column. I can start this code as late as
column O then there would be onough cells to look back -8.

But I can't figure out how to do it.

Thanks


With Sheet236
For x = 11 To 298
counter = 8

For n = 1 To timeStart

Next n
If .Cells(x, skilly).Value = "x" And did = False Then
For y = timeStart To timeStart + 7

If .Cells(x, y).Value = "." _
And counter < 9 _
And need 0 _
And x = 19 _
And .Cells(x, y).Value < "" _
And .Cells(x, y).Offset(-8, 0).Value < "IND" _
And .Cells(x, y).Offset(8, 0).Value < "IND" _
And .Cells(x, y).Offset(0, 8).Value < "IND" Then
_

Cells(x, y).Offset(0, 0).Resize(1, 8).Value = "ENG"
'.Cells(x, y).Value = "ENG"
counter = counter + 1
need = need - 8
End If


---
Message posted from http://www.ExcelForum.com/




hotherps[_129_]

Initialize variable
 
Is there anything you don't know Tom?


Thanks so much that was perfect, I've been toying with it for hours.

Thanks again!
Ji

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com