ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Mixing For i = x to y and j = z to y for lines and columns (https://www.excelbanter.com/excel-programming/368846-mixing-i-%3D-x-y-j-%3D-z-y-lines-columns.html)

[email protected]

Mixing For i = x to y and j = z to y for lines and columns
 
hello, this morning I have been explained how to use For expression for
columns definitions, but I am trying without success to mix it with For
expression for lines.
Right now code looks like
______________
Sub TEST
For i = 4 To 32 Step 1
For j = 3 To 6
If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
Next i
Next j
End Sub
_______________
Not working!
I was before that writing

If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE

and I do not want to repeat it for every columns...
help??
many thanks!
Daniel


mcg

Mixing For i = x to y and j = z to y for lines and columns
 

napisal(a):
hello, this morning I have been explained how to use For expression for
columns definitions, but I am trying without success to mix it with For
expression for lines.
Right now code looks like
______________
Sub TEST
For i = 4 To 32 Step 1
For j = 3 To 6
If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
Next i
Next j
End Sub
_______________
Not working!
I was before that writing

If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE

and I do not want to repeat it for every columns...
help??
many thanks!
Daniel



try to change Range(Columns(j) & i)
into cells(i,j)
mcg


Tom Ogilvy

Mixing For i = x to y and j = z to y for lines and columns
 
Sub TEST
For i = 4 To 32 Step 1
For j = 3 To 6
If Worksheets("Skew Matrix").Cells(i,j).Value = "" then

End if
Next i
Next j
End Sub

--
Regards,
Tom Ogilvy

" wrote:

hello, this morning I have been explained how to use For expression for
columns definitions, but I am trying without success to mix it with For
expression for lines.
Right now code looks like
______________
Sub TEST
For i = 4 To 32 Step 1
For j = 3 To 6
If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
Next i
Next j
End Sub
_______________
Not working!
I was before that writing

If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE

and I do not want to repeat it for every columns...
help??
many thanks!
Daniel



[email protected]

Mixing For i = x to y and j = z to y for lines and columns
 
Many thanks,
it seems ok, I have a small problem, but I should be able to sort it
Many thanks, I know understand the logic, what is always greater than
to find the solution!
regards
Daniel
Tom Ogilvy wrote:
Sub TEST
For i = 4 To 32 Step 1
For j = 3 To 6
If Worksheets("Skew Matrix").Cells(i,j).Value = "" then

End if
Next i
Next j
End Sub

--
Regards,
Tom Ogilvy

" wrote:

hello, this morning I have been explained how to use For expression for
columns definitions, but I am trying without success to mix it with For
expression for lines.
Right now code looks like
______________
Sub TEST
For i = 4 To 32 Step 1
For j = 3 To 6
If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
Next i
Next j
End Sub
_______________
Not working!
I was before that writing

If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE

and I do not want to repeat it for every columns...
help??
many thanks!
Daniel





All times are GMT +1. The time now is 01:12 AM.

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